1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Core\Facade; |
4: | |
5: | use Salient\Contract\Sync\DeferredEntityInterface; |
6: | use Salient\Contract\Sync\DeferredRelationshipInterface; |
7: | use Salient\Contract\Sync\SyncEntityInterface; |
8: | use Salient\Contract\Sync\SyncErrorCollectionInterface; |
9: | use Salient\Contract\Sync\SyncErrorInterface; |
10: | use Salient\Contract\Sync\SyncNamespaceHelperInterface; |
11: | use Salient\Contract\Sync\SyncProviderInterface; |
12: | use Salient\Contract\Sync\SyncStoreInterface; |
13: | use Salient\Core\AbstractFacade; |
14: | use Salient\Sync\SyncStore; |
15: | |
16: | /** |
17: | * A facade for the global sync entity store |
18: | * |
19: | * @method static SyncStoreInterface checkProviderHeartbeats(int $ttl = 300, bool $failEarly = true, SyncProviderInterface ...$providers) Throw an exception if a sync provider's backend is unreachable (see {@see SyncStoreInterface::checkProviderHeartbeats()}) |
20: | * @method static SyncStoreInterface deferEntity(int $providerId, class-string<SyncEntityInterface> $entityType, int|string $entityId, DeferredEntityInterface<SyncEntityInterface> $entity) Register a deferred entity with the entity store (see {@see SyncStoreInterface::deferEntity()}) |
21: | * @method static SyncStoreInterface deferRelationship(int $providerId, class-string<SyncEntityInterface> $entityType, class-string<SyncEntityInterface> $forEntityType, string $forEntityProperty, int|string $forEntityId, DeferredRelationshipInterface<SyncEntityInterface> $relationship) Register a deferred relationship with the entity store |
22: | * @method static string getBinaryRunUuid() Get the UUID of the current run in raw binary form |
23: | * @method static int getDeferralCheckpoint() Get a checkpoint to delineate between deferred entities and relationships that have already been registered, and any subsequent deferrals (see {@see SyncStoreInterface::getDeferralCheckpoint()}) |
24: | * @method static SyncEntityInterface|null getEntity(int $providerId, class-string<SyncEntityInterface> $entityType, int|string $entityId, bool|null $offline = null) Get a sync entity from the entity store if it is available (see {@see SyncStoreInterface::getEntity()}) |
25: | * @method static class-string<SyncEntityInterface> getEntityType(int $entityTypeId) Get a sync entity type registered with the entity store |
26: | * @method static int getEntityTypeId(class-string<SyncEntityInterface> $entityType) Get the entity type ID of a registered sync entity type |
27: | * @method static string getEntityTypeUri(class-string<SyncEntityInterface> $entityType, bool $compact = true) Get the canonical URI of a sync entity type |
28: | * @method static SyncErrorCollectionInterface getErrors() Get sync operation errors recorded so far |
29: | * @method static SyncNamespaceHelperInterface|null getNamespaceHelper(class-string<SyncEntityInterface|SyncProviderInterface> $class) Get a namespace helper for a sync entity type or provider interface, or null if it is not in a namespace with a registered helper |
30: | * @method static string|null getNamespacePrefix(class-string<SyncEntityInterface|SyncProviderInterface> $class) Get a namespace prefix for a sync entity type or provider interface, or null if it is not in a registered namespace |
31: | * @method static SyncProviderInterface getProvider(string|int $provider) Get a sync provider registered with the entity store (see {@see SyncStoreInterface::getProvider()}) |
32: | * @method static int getProviderId(SyncProviderInterface|string $provider) Get the provider ID by which a registered sync provider is uniquely identified in the entity store's backing database (see {@see SyncStoreInterface::getProviderId()}) |
33: | * @method static string getProviderSignature(SyncProviderInterface $provider) Get a stable value that uniquely identifies a sync provider with the entity store and is independent of its backing database |
34: | * @method static int getRunId() Get the run ID of the current run |
35: | * @method static string getRunUuid() Get the UUID of the current run in hexadecimal form |
36: | * @method static bool hasEntityType(class-string<SyncEntityInterface> $entityType) Check if a sync entity type is registered with the entity store |
37: | * @method static bool hasProvider(SyncProviderInterface|string $provider) Check if a sync provider is registered with the entity store (see {@see SyncStoreInterface::hasProvider()}) |
38: | * @method static SyncStoreInterface recordError(SyncErrorInterface $error, bool $deduplicate = false) Register a non-fatal sync operation error with the entity store |
39: | * @method static SyncStoreInterface registerEntityType(class-string<SyncEntityInterface> $entityType) Register a sync entity type with the entity store if it is not already registered (see {@see SyncStoreInterface::registerEntityType()}) |
40: | * @method static SyncStoreInterface registerNamespace(string $prefix, string $uri, string $namespace, SyncNamespaceHelperInterface|null $helper = null) Register a namespace for sync entities and their provider interfaces (see {@see SyncStoreInterface::registerNamespace()}) |
41: | * @method static SyncStoreInterface registerProvider(SyncProviderInterface $provider) Register a sync provider with the entity store |
42: | * @method static SyncEntityInterface[] resolveDeferrals(int|null $fromCheckpoint = null, class-string<SyncEntityInterface>|null $entityType = null, int|null $providerId = null) Resolve deferred entities and relationships recursively until no deferrals remain |
43: | * @method static SyncEntityInterface[] resolveDeferredEntities(int|null $fromCheckpoint = null, class-string<SyncEntityInterface>|null $entityType = null, int|null $providerId = null) Resolve deferred entities |
44: | * @method static SyncEntityInterface[][] resolveDeferredRelationships(int|null $fromCheckpoint = null, class-string<SyncEntityInterface>|null $entityType = null, class-string<SyncEntityInterface>|null $forEntityType = null, string|null $forEntityProperty = null, int|null $providerId = null) Resolve deferred relationships |
45: | * @method static bool runHasStarted() Check if a run of sync operations has started |
46: | * @method static SyncStoreInterface setEntity(int $providerId, class-string<SyncEntityInterface> $entityType, int|string $entityId, SyncEntityInterface $entity) Apply a sync entity retrieved from a provider to the entity store, resolving any matching deferred entities |
47: | * |
48: | * @extends AbstractFacade<SyncStoreInterface> |
49: | * |
50: | * @generated |
51: | */ |
52: | final class Sync extends AbstractFacade |
53: | { |
54: | /** |
55: | * @internal |
56: | */ |
57: | protected static function getService() |
58: | { |
59: | return [ |
60: | SyncStoreInterface::class => SyncStore::class, |
61: | ]; |
62: | } |
63: | } |
64: |