@effect/cluster 0.0.0-snapshot-d33d8b050b8e3c87dcde9587083e6c1cf733f72b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AtLeastOnce/package.json +6 -0
- package/AtLeastOnceStorage/package.json +6 -0
- package/Broadcaster/package.json +6 -0
- package/LICENSE +21 -0
- package/ManagerConfig/package.json +6 -0
- package/Message/package.json +6 -0
- package/MessageState/package.json +6 -0
- package/Messenger/package.json +6 -0
- package/Pod/package.json +6 -0
- package/PodAddress/package.json +6 -0
- package/Pods/package.json +6 -0
- package/PodsHealth/package.json +6 -0
- package/PoisonPill/package.json +6 -0
- package/README.md +3 -0
- package/RecipientAddress/package.json +6 -0
- package/RecipientBehaviour/package.json +6 -0
- package/RecipientBehaviourContext/package.json +6 -0
- package/RecipientType/package.json +6 -0
- package/Serialization/package.json +6 -0
- package/SerializedEnvelope/package.json +6 -0
- package/SerializedMessage/package.json +6 -0
- package/ShardId/package.json +6 -0
- package/ShardManager/package.json +6 -0
- package/ShardManagerClient/package.json +6 -0
- package/Sharding/package.json +6 -0
- package/ShardingConfig/package.json +6 -0
- package/ShardingEvent/package.json +6 -0
- package/ShardingException/package.json +6 -0
- package/ShardingRegistrationEvent/package.json +6 -0
- package/Storage/package.json +6 -0
- package/dist/cjs/AtLeastOnce.js +43 -0
- package/dist/cjs/AtLeastOnce.js.map +1 -0
- package/dist/cjs/AtLeastOnceStorage.js +48 -0
- package/dist/cjs/AtLeastOnceStorage.js.map +1 -0
- package/dist/cjs/Broadcaster.js +6 -0
- package/dist/cjs/Broadcaster.js.map +1 -0
- package/dist/cjs/ManagerConfig.js +57 -0
- package/dist/cjs/ManagerConfig.js.map +1 -0
- package/dist/cjs/Message.js +64 -0
- package/dist/cjs/Message.js.map +1 -0
- package/dist/cjs/MessageState.js +78 -0
- package/dist/cjs/MessageState.js.map +1 -0
- package/dist/cjs/Messenger.js +6 -0
- package/dist/cjs/Messenger.js.map +1 -0
- package/dist/cjs/Pod.js +101 -0
- package/dist/cjs/Pod.js.map +1 -0
- package/dist/cjs/PodAddress.js +100 -0
- package/dist/cjs/PodAddress.js.map +1 -0
- package/dist/cjs/Pods.js +58 -0
- package/dist/cjs/Pods.js.map +1 -0
- package/dist/cjs/PodsHealth.js +64 -0
- package/dist/cjs/PodsHealth.js.map +1 -0
- package/dist/cjs/PoisonPill.js +101 -0
- package/dist/cjs/PoisonPill.js.map +1 -0
- package/dist/cjs/RecipientAddress.js +102 -0
- package/dist/cjs/RecipientAddress.js.map +1 -0
- package/dist/cjs/RecipientBehaviour.js +61 -0
- package/dist/cjs/RecipientBehaviour.js.map +1 -0
- package/dist/cjs/RecipientBehaviourContext.js +87 -0
- package/dist/cjs/RecipientBehaviourContext.js.map +1 -0
- package/dist/cjs/RecipientType.js +142 -0
- package/dist/cjs/RecipientType.js.map +1 -0
- package/dist/cjs/Serialization.js +55 -0
- package/dist/cjs/Serialization.js.map +1 -0
- package/dist/cjs/SerializedEnvelope.js +111 -0
- package/dist/cjs/SerializedEnvelope.js.map +1 -0
- package/dist/cjs/SerializedMessage.js +87 -0
- package/dist/cjs/SerializedMessage.js.map +1 -0
- package/dist/cjs/ShardId.js +89 -0
- package/dist/cjs/ShardId.js.map +1 -0
- package/dist/cjs/ShardManager.js +48 -0
- package/dist/cjs/ShardManager.js.map +1 -0
- package/dist/cjs/ShardManagerClient.js +53 -0
- package/dist/cjs/ShardManagerClient.js.map +1 -0
- package/dist/cjs/Sharding.js +129 -0
- package/dist/cjs/Sharding.js.map +1 -0
- package/dist/cjs/ShardingConfig.js +64 -0
- package/dist/cjs/ShardingConfig.js.map +1 -0
- package/dist/cjs/ShardingEvent.js +72 -0
- package/dist/cjs/ShardingEvent.js.map +1 -0
- package/dist/cjs/ShardingException.js +130 -0
- package/dist/cjs/ShardingException.js.map +1 -0
- package/dist/cjs/ShardingRegistrationEvent.js +44 -0
- package/dist/cjs/ShardingRegistrationEvent.js.map +1 -0
- package/dist/cjs/Storage.js +63 -0
- package/dist/cjs/Storage.js.map +1 -0
- package/dist/cjs/index.js +88 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internal/atLeastOnce.js +58 -0
- package/dist/cjs/internal/atLeastOnce.js.map +1 -0
- package/dist/cjs/internal/atLeastOnceStorage.js +186 -0
- package/dist/cjs/internal/atLeastOnceStorage.js.map +1 -0
- package/dist/cjs/internal/entityManager.js +191 -0
- package/dist/cjs/internal/entityManager.js.map +1 -0
- package/dist/cjs/internal/entityState.js +70 -0
- package/dist/cjs/internal/entityState.js.map +1 -0
- package/dist/cjs/internal/managerConfig.js +69 -0
- package/dist/cjs/internal/managerConfig.js.map +1 -0
- package/dist/cjs/internal/message.js +68 -0
- package/dist/cjs/internal/message.js.map +1 -0
- package/dist/cjs/internal/messageState.js +102 -0
- package/dist/cjs/internal/messageState.js.map +1 -0
- package/dist/cjs/internal/podWithMetadata.js +77 -0
- package/dist/cjs/internal/podWithMetadata.js.map +1 -0
- package/dist/cjs/internal/pods.js +58 -0
- package/dist/cjs/internal/pods.js.map +1 -0
- package/dist/cjs/internal/podsHealth.js +63 -0
- package/dist/cjs/internal/podsHealth.js.map +1 -0
- package/dist/cjs/internal/recipientBehaviour.js +75 -0
- package/dist/cjs/internal/recipientBehaviour.js.map +1 -0
- package/dist/cjs/internal/recipientBehaviourContext.js +59 -0
- package/dist/cjs/internal/recipientBehaviourContext.js.map +1 -0
- package/dist/cjs/internal/serialization.js +72 -0
- package/dist/cjs/internal/serialization.js.map +1 -0
- package/dist/cjs/internal/shardManager.js +291 -0
- package/dist/cjs/internal/shardManager.js.map +1 -0
- package/dist/cjs/internal/shardManagerClient.js +71 -0
- package/dist/cjs/internal/shardManagerClient.js.map +1 -0
- package/dist/cjs/internal/shardManagerState.js +67 -0
- package/dist/cjs/internal/shardManagerState.js.map +1 -0
- package/dist/cjs/internal/sharding.js +329 -0
- package/dist/cjs/internal/sharding.js.map +1 -0
- package/dist/cjs/internal/shardingConfig.js +79 -0
- package/dist/cjs/internal/shardingConfig.js.map +1 -0
- package/dist/cjs/internal/storage.js +75 -0
- package/dist/cjs/internal/storage.js.map +1 -0
- package/dist/cjs/internal/utils.js +92 -0
- package/dist/cjs/internal/utils.js.map +1 -0
- package/dist/dts/AtLeastOnce.d.ts +20 -0
- package/dist/dts/AtLeastOnce.d.ts.map +1 -0
- package/dist/dts/AtLeastOnceStorage.d.ts +75 -0
- package/dist/dts/AtLeastOnceStorage.d.ts.map +1 -0
- package/dist/dts/Broadcaster.d.ts +32 -0
- package/dist/dts/Broadcaster.d.ts.map +1 -0
- package/dist/dts/ManagerConfig.d.ts +61 -0
- package/dist/dts/ManagerConfig.d.ts.map +1 -0
- package/dist/dts/Message.d.ts +106 -0
- package/dist/dts/Message.d.ts.map +1 -0
- package/dist/dts/MessageState.d.ts +107 -0
- package/dist/dts/MessageState.d.ts.map +1 -0
- package/dist/dts/Messenger.d.ts +32 -0
- package/dist/dts/Messenger.d.ts.map +1 -0
- package/dist/dts/Pod.d.ts +81 -0
- package/dist/dts/Pod.d.ts.map +1 -0
- package/dist/dts/PodAddress.d.ts +80 -0
- package/dist/dts/PodAddress.d.ts.map +1 -0
- package/dist/dts/Pods.d.ts +78 -0
- package/dist/dts/Pods.d.ts.map +1 -0
- package/dist/dts/PodsHealth.d.ts +66 -0
- package/dist/dts/PodsHealth.d.ts.map +1 -0
- package/dist/dts/PoisonPill.d.ts +78 -0
- package/dist/dts/PoisonPill.d.ts.map +1 -0
- package/dist/dts/RecipientAddress.d.ts +57 -0
- package/dist/dts/RecipientAddress.d.ts.map +1 -0
- package/dist/dts/RecipientBehaviour.d.ts +72 -0
- package/dist/dts/RecipientBehaviour.d.ts.map +1 -0
- package/dist/dts/RecipientBehaviourContext.d.ts +83 -0
- package/dist/dts/RecipientBehaviourContext.d.ts.map +1 -0
- package/dist/dts/RecipientType.d.ts +96 -0
- package/dist/dts/RecipientType.d.ts.map +1 -0
- package/dist/dts/Serialization.d.ts +58 -0
- package/dist/dts/Serialization.d.ts.map +1 -0
- package/dist/dts/SerializedEnvelope.d.ts +87 -0
- package/dist/dts/SerializedEnvelope.d.ts.map +1 -0
- package/dist/dts/SerializedMessage.d.ts +66 -0
- package/dist/dts/SerializedMessage.d.ts.map +1 -0
- package/dist/dts/ShardId.d.ts +70 -0
- package/dist/dts/ShardId.d.ts.map +1 -0
- package/dist/dts/ShardManager.d.ts +44 -0
- package/dist/dts/ShardManager.d.ts.map +1 -0
- package/dist/dts/ShardManagerClient.d.ts +50 -0
- package/dist/dts/ShardManagerClient.d.ts.map +1 -0
- package/dist/dts/Sharding.d.ts +146 -0
- package/dist/dts/Sharding.d.ts.map +1 -0
- package/dist/dts/ShardingConfig.d.ts +69 -0
- package/dist/dts/ShardingConfig.d.ts.map +1 -0
- package/dist/dts/ShardingEvent.d.ts +90 -0
- package/dist/dts/ShardingEvent.d.ts.map +1 -0
- package/dist/dts/ShardingException.d.ts +125 -0
- package/dist/dts/ShardingException.d.ts.map +1 -0
- package/dist/dts/ShardingRegistrationEvent.d.ts +44 -0
- package/dist/dts/ShardingRegistrationEvent.d.ts.map +1 -0
- package/dist/dts/Storage.d.ts +78 -0
- package/dist/dts/Storage.d.ts.map +1 -0
- package/dist/dts/index.d.ts +113 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/internal/atLeastOnce.d.ts +2 -0
- package/dist/dts/internal/atLeastOnce.d.ts.map +1 -0
- package/dist/dts/internal/atLeastOnceStorage.d.ts +2 -0
- package/dist/dts/internal/atLeastOnceStorage.d.ts.map +1 -0
- package/dist/dts/internal/entityManager.d.ts +2 -0
- package/dist/dts/internal/entityManager.d.ts.map +1 -0
- package/dist/dts/internal/entityState.d.ts +21 -0
- package/dist/dts/internal/entityState.d.ts.map +1 -0
- package/dist/dts/internal/managerConfig.d.ts +2 -0
- package/dist/dts/internal/managerConfig.d.ts.map +1 -0
- package/dist/dts/internal/message.d.ts +9 -0
- package/dist/dts/internal/message.d.ts.map +1 -0
- package/dist/dts/internal/messageState.d.ts +2 -0
- package/dist/dts/internal/messageState.d.ts.map +1 -0
- package/dist/dts/internal/podWithMetadata.d.ts +2 -0
- package/dist/dts/internal/podWithMetadata.d.ts.map +1 -0
- package/dist/dts/internal/pods.d.ts +2 -0
- package/dist/dts/internal/pods.d.ts.map +1 -0
- package/dist/dts/internal/podsHealth.d.ts +2 -0
- package/dist/dts/internal/podsHealth.d.ts.map +1 -0
- package/dist/dts/internal/recipientBehaviour.d.ts +2 -0
- package/dist/dts/internal/recipientBehaviour.d.ts.map +1 -0
- package/dist/dts/internal/recipientBehaviourContext.d.ts +2 -0
- package/dist/dts/internal/recipientBehaviourContext.d.ts.map +1 -0
- package/dist/dts/internal/serialization.d.ts +2 -0
- package/dist/dts/internal/serialization.d.ts.map +1 -0
- package/dist/dts/internal/shardManager.d.ts +12 -0
- package/dist/dts/internal/shardManager.d.ts.map +1 -0
- package/dist/dts/internal/shardManagerClient.d.ts +2 -0
- package/dist/dts/internal/shardManagerClient.d.ts.map +1 -0
- package/dist/dts/internal/shardManagerState.d.ts +26 -0
- package/dist/dts/internal/shardManagerState.d.ts.map +1 -0
- package/dist/dts/internal/sharding.d.ts +2 -0
- package/dist/dts/internal/sharding.d.ts.map +1 -0
- package/dist/dts/internal/shardingConfig.d.ts +2 -0
- package/dist/dts/internal/shardingConfig.d.ts.map +1 -0
- package/dist/dts/internal/storage.d.ts +2 -0
- package/dist/dts/internal/storage.d.ts.map +1 -0
- package/dist/dts/internal/utils.d.ts +2 -0
- package/dist/dts/internal/utils.d.ts.map +1 -0
- package/dist/esm/AtLeastOnce.js +12 -0
- package/dist/esm/AtLeastOnce.js.map +1 -0
- package/dist/esm/AtLeastOnceStorage.js +17 -0
- package/dist/esm/AtLeastOnceStorage.js.map +1 -0
- package/dist/esm/Broadcaster.js +2 -0
- package/dist/esm/Broadcaster.js.map +1 -0
- package/dist/esm/ManagerConfig.js +26 -0
- package/dist/esm/ManagerConfig.js.map +1 -0
- package/dist/esm/Message.js +33 -0
- package/dist/esm/Message.js.map +1 -0
- package/dist/esm/MessageState.js +47 -0
- package/dist/esm/MessageState.js.map +1 -0
- package/dist/esm/Messenger.js +2 -0
- package/dist/esm/Messenger.js.map +1 -0
- package/dist/esm/Pod.js +65 -0
- package/dist/esm/Pod.js.map +1 -0
- package/dist/esm/PodAddress.js +64 -0
- package/dist/esm/PodAddress.js.map +1 -0
- package/dist/esm/Pods.js +27 -0
- package/dist/esm/Pods.js.map +1 -0
- package/dist/esm/PodsHealth.js +33 -0
- package/dist/esm/PodsHealth.js.map +1 -0
- package/dist/esm/PoisonPill.js +65 -0
- package/dist/esm/PoisonPill.js.map +1 -0
- package/dist/esm/RecipientAddress.js +67 -0
- package/dist/esm/RecipientAddress.js.map +1 -0
- package/dist/esm/RecipientBehaviour.js +30 -0
- package/dist/esm/RecipientBehaviour.js.map +1 -0
- package/dist/esm/RecipientBehaviourContext.js +56 -0
- package/dist/esm/RecipientBehaviourContext.js.map +1 -0
- package/dist/esm/RecipientType.js +105 -0
- package/dist/esm/RecipientType.js.map +1 -0
- package/dist/esm/Serialization.js +24 -0
- package/dist/esm/Serialization.js.map +1 -0
- package/dist/esm/SerializedEnvelope.js +75 -0
- package/dist/esm/SerializedEnvelope.js.map +1 -0
- package/dist/esm/SerializedMessage.js +51 -0
- package/dist/esm/SerializedMessage.js.map +1 -0
- package/dist/esm/ShardId.js +54 -0
- package/dist/esm/ShardId.js.map +1 -0
- package/dist/esm/ShardManager.js +17 -0
- package/dist/esm/ShardManager.js.map +1 -0
- package/dist/esm/ShardManagerClient.js +22 -0
- package/dist/esm/ShardManagerClient.js.map +1 -0
- package/dist/esm/Sharding.js +98 -0
- package/dist/esm/Sharding.js.map +1 -0
- package/dist/esm/ShardingConfig.js +33 -0
- package/dist/esm/ShardingConfig.js.map +1 -0
- package/dist/esm/ShardingEvent.js +62 -0
- package/dist/esm/ShardingEvent.js.map +1 -0
- package/dist/esm/ShardingException.js +91 -0
- package/dist/esm/ShardingException.js.map +1 -0
- package/dist/esm/ShardingRegistrationEvent.js +36 -0
- package/dist/esm/ShardingRegistrationEvent.js.map +1 -0
- package/dist/esm/Storage.js +32 -0
- package/dist/esm/Storage.js.map +1 -0
- package/dist/esm/index.js +113 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/atLeastOnce.js +26 -0
- package/dist/esm/internal/atLeastOnce.js.map +1 -0
- package/dist/esm/internal/atLeastOnceStorage.js +154 -0
- package/dist/esm/internal/atLeastOnceStorage.js.map +1 -0
- package/dist/esm/internal/entityManager.js +159 -0
- package/dist/esm/internal/entityManager.js.map +1 -0
- package/dist/esm/internal/entityState.js +35 -0
- package/dist/esm/internal/entityState.js.map +1 -0
- package/dist/esm/internal/managerConfig.js +38 -0
- package/dist/esm/internal/managerConfig.js.map +1 -0
- package/dist/esm/internal/message.js +32 -0
- package/dist/esm/internal/message.js.map +1 -0
- package/dist/esm/internal/messageState.js +66 -0
- package/dist/esm/internal/messageState.js.map +1 -0
- package/dist/esm/internal/podWithMetadata.js +41 -0
- package/dist/esm/internal/podWithMetadata.js.map +1 -0
- package/dist/esm/internal/pods.js +25 -0
- package/dist/esm/internal/pods.js.map +1 -0
- package/dist/esm/internal/podsHealth.js +30 -0
- package/dist/esm/internal/podsHealth.js.map +1 -0
- package/dist/esm/internal/recipientBehaviour.js +42 -0
- package/dist/esm/internal/recipientBehaviour.js.map +1 -0
- package/dist/esm/internal/recipientBehaviourContext.js +26 -0
- package/dist/esm/internal/recipientBehaviourContext.js.map +1 -0
- package/dist/esm/internal/serialization.js +39 -0
- package/dist/esm/internal/serialization.js.map +1 -0
- package/dist/esm/internal/shardManager.js +256 -0
- package/dist/esm/internal/shardManager.js.map +1 -0
- package/dist/esm/internal/shardManagerClient.js +38 -0
- package/dist/esm/internal/shardManagerClient.js.map +1 -0
- package/dist/esm/internal/shardManagerState.js +36 -0
- package/dist/esm/internal/shardManagerState.js.map +1 -0
- package/dist/esm/internal/sharding.js +288 -0
- package/dist/esm/internal/sharding.js.map +1 -0
- package/dist/esm/internal/shardingConfig.js +47 -0
- package/dist/esm/internal/shardingConfig.js.map +1 -0
- package/dist/esm/internal/storage.js +42 -0
- package/dist/esm/internal/storage.js.map +1 -0
- package/dist/esm/internal/utils.js +56 -0
- package/dist/esm/internal/utils.js.map +1 -0
- package/dist/esm/package.json +4 -0
- package/package.json +259 -0
- package/src/AtLeastOnce.ts +28 -0
- package/src/AtLeastOnceStorage.ts +96 -0
- package/src/Broadcaster.ts +48 -0
- package/src/ManagerConfig.ts +67 -0
- package/src/Message.ts +132 -0
- package/src/MessageState.ts +126 -0
- package/src/Messenger.ts +40 -0
- package/src/Pod.ts +95 -0
- package/src/PodAddress.ts +94 -0
- package/src/Pods.ts +100 -0
- package/src/PodsHealth.ts +74 -0
- package/src/PoisonPill.ts +105 -0
- package/src/RecipientAddress.ts +72 -0
- package/src/RecipientBehaviour.ts +108 -0
- package/src/RecipientBehaviourContext.ts +101 -0
- package/src/RecipientType.ts +134 -0
- package/src/Serialization.ts +72 -0
- package/src/SerializedEnvelope.ts +109 -0
- package/src/SerializedMessage.ts +82 -0
- package/src/ShardId.ts +79 -0
- package/src/ShardManager.ts +53 -0
- package/src/ShardManagerClient.ts +57 -0
- package/src/Sharding.ts +214 -0
- package/src/ShardingConfig.ts +76 -0
- package/src/ShardingEvent.ts +121 -0
- package/src/ShardingException.ts +151 -0
- package/src/ShardingRegistrationEvent.ts +62 -0
- package/src/Storage.ts +92 -0
- package/src/index.ts +139 -0
- package/src/internal/atLeastOnce.ts +59 -0
- package/src/internal/atLeastOnceStorage.ts +218 -0
- package/src/internal/entityManager.ts +404 -0
- package/src/internal/entityState.ts +64 -0
- package/src/internal/managerConfig.ts +84 -0
- package/src/internal/message.ts +64 -0
- package/src/internal/messageState.ts +98 -0
- package/src/internal/podWithMetadata.ts +72 -0
- package/src/internal/pods.ts +29 -0
- package/src/internal/podsHealth.ts +39 -0
- package/src/internal/recipientBehaviour.ts +133 -0
- package/src/internal/recipientBehaviourContext.ts +70 -0
- package/src/internal/serialization.ts +59 -0
- package/src/internal/shardManager.ts +593 -0
- package/src/internal/shardManagerClient.ts +49 -0
- package/src/internal/shardManagerState.ts +80 -0
- package/src/internal/sharding.ts +793 -0
- package/src/internal/shardingConfig.ts +97 -0
- package/src/internal/storage.ts +60 -0
- package/src/internal/utils.ts +54 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
/**
|
2
|
+
* @since 1.0.0
|
3
|
+
*/
|
4
|
+
import type * as Effect from "effect/Effect"
|
5
|
+
import type * as HashMap from "effect/HashMap"
|
6
|
+
import type * as Option from "effect/Option"
|
7
|
+
import type * as Stream from "effect/Stream"
|
8
|
+
import * as internal from "./internal/shardManager.js"
|
9
|
+
import type * as Pod from "./Pod.js"
|
10
|
+
import type * as PodAddress from "./PodAddress.js"
|
11
|
+
import type * as ShardId from "./ShardId.js"
|
12
|
+
import type * as ShardingEvent from "./ShardingEvent.js"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @since 1.0.0
|
16
|
+
* @category symbols
|
17
|
+
*/
|
18
|
+
export const ShardManagerTypeId: unique symbol = internal.ShardManagerTypeId
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @since 1.0.0
|
22
|
+
* @category symbols
|
23
|
+
*/
|
24
|
+
export type ShardManagerTypeId = typeof ShardManagerTypeId
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @since 1.0.0
|
28
|
+
* @category context
|
29
|
+
*/
|
30
|
+
export const ShardManager = internal.shardManagerTag
|
31
|
+
|
32
|
+
/**
|
33
|
+
* @since 1.0.0
|
34
|
+
* @category models
|
35
|
+
*/
|
36
|
+
export interface ShardManager {
|
37
|
+
readonly getShardingEvents: Stream.Stream<ShardingEvent.ShardingEvent>
|
38
|
+
readonly register: (pod: Pod.Pod) => Effect.Effect<void>
|
39
|
+
readonly unregister: (podAddress: PodAddress.PodAddress) => Effect.Effect<void>
|
40
|
+
readonly notifyUnhealthyPod: (podAddress: PodAddress.PodAddress) => Effect.Effect<void>
|
41
|
+
readonly checkAllPodsHealth: Effect.Effect<void>
|
42
|
+
readonly getAssignments: Effect.Effect<HashMap.HashMap<ShardId.ShardId, Option.Option<PodAddress.PodAddress>>>
|
43
|
+
/* @internal */
|
44
|
+
readonly rebalance: (rebalanceImmediately: boolean) => Effect.Effect<void>
|
45
|
+
/* @internal */
|
46
|
+
readonly persistPods: Effect.Effect<void>
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* @since 1.0.0
|
51
|
+
* @category layers
|
52
|
+
*/
|
53
|
+
export const live = internal.live
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/**
|
2
|
+
* @since 1.0.0
|
3
|
+
*/
|
4
|
+
import type * as Context from "effect/Context"
|
5
|
+
import type * as Effect from "effect/Effect"
|
6
|
+
import type * as HashMap from "effect/HashMap"
|
7
|
+
import type * as Layer from "effect/Layer"
|
8
|
+
import type * as Option from "effect/Option"
|
9
|
+
import * as internal from "./internal/shardManagerClient.js"
|
10
|
+
import type * as PodAddress from "./PodAddress.js"
|
11
|
+
import type * as ShardId from "./ShardId.js"
|
12
|
+
import type * as ShardingConfig from "./ShardingConfig.js"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @since 1.0.0
|
16
|
+
* @category symbols
|
17
|
+
*/
|
18
|
+
export const ShardManagerClientTypeId: unique symbol = internal.ShardManagerClientTypeId
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @since 1.0.0
|
22
|
+
* @category models
|
23
|
+
*/
|
24
|
+
export type ShardManagerClientTypeId = typeof ShardManagerClientTypeId
|
25
|
+
|
26
|
+
/**
|
27
|
+
* ShardManagerClient provides the methods exposed by the ShardManager and called by the Pod.
|
28
|
+
*
|
29
|
+
* @since 1.0.0
|
30
|
+
* @category models
|
31
|
+
*/
|
32
|
+
export interface ShardManagerClient {
|
33
|
+
readonly [ShardManagerClientTypeId]: ShardManagerClientTypeId
|
34
|
+
readonly register: (podAddress: PodAddress.PodAddress) => Effect.Effect<void>
|
35
|
+
readonly unregister: (podAddress: PodAddress.PodAddress) => Effect.Effect<void>
|
36
|
+
readonly notifyUnhealthyPod: (podAddress: PodAddress.PodAddress) => Effect.Effect<void>
|
37
|
+
readonly getAssignments: Effect.Effect<HashMap.HashMap<ShardId.ShardId, Option.Option<PodAddress.PodAddress>>>
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @since 1.0.0
|
42
|
+
* @category constructors
|
43
|
+
*/
|
44
|
+
export const make: (args: Omit<ShardManagerClient, typeof ShardManagerClientTypeId>) => ShardManagerClient =
|
45
|
+
internal.make
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @since 1.0.0
|
49
|
+
* @category context
|
50
|
+
*/
|
51
|
+
export const ShardManagerClient: Context.Tag<ShardManagerClient, ShardManagerClient> = internal.shardManagerClientTag
|
52
|
+
|
53
|
+
/**
|
54
|
+
* @since 1.0.0
|
55
|
+
* @category layers
|
56
|
+
*/
|
57
|
+
export const local: Layer.Layer<ShardManagerClient, never, ShardingConfig.ShardingConfig> = internal.local
|
package/src/Sharding.ts
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
/**
|
2
|
+
* @since 1.0.0
|
3
|
+
*/
|
4
|
+
import type * as Effect from "effect/Effect"
|
5
|
+
import type * as HashSet from "effect/HashSet"
|
6
|
+
import type * as Scope from "effect/Scope"
|
7
|
+
import type * as Stream from "effect/Stream"
|
8
|
+
import type { Broadcaster } from "./Broadcaster.js"
|
9
|
+
import * as internal from "./internal/sharding.js"
|
10
|
+
import type * as Message from "./Message.js"
|
11
|
+
import type * as MessageState from "./MessageState.js"
|
12
|
+
import type { Messenger } from "./Messenger.js"
|
13
|
+
import type * as PodAddress from "./PodAddress.js"
|
14
|
+
import type * as RecipientAddress from "./RecipientAddress.js"
|
15
|
+
import type * as RecipientBehaviour from "./RecipientBehaviour.js"
|
16
|
+
import type * as RecipientBehaviourContext from "./RecipientBehaviourContext.js"
|
17
|
+
import type * as RecipentType from "./RecipientType.js"
|
18
|
+
import type * as SerializedEnvelope from "./SerializedEnvelope.js"
|
19
|
+
import type * as SerializedMessage from "./SerializedMessage.js"
|
20
|
+
import type * as ShardId from "./ShardId.js"
|
21
|
+
import type * as ShardingException from "./ShardingException.js"
|
22
|
+
import type * as ShardingRegistrationEvent from "./ShardingRegistrationEvent.js"
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @since 1.0.0
|
26
|
+
* @category symbols
|
27
|
+
*/
|
28
|
+
export const ShardingTypeId: unique symbol = internal.ShardingTypeId
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @since 1.0.0
|
32
|
+
* @category symbols
|
33
|
+
*/
|
34
|
+
export type ShardingTypeId = typeof ShardingTypeId
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @since 1.0.0
|
38
|
+
* @category models
|
39
|
+
*/
|
40
|
+
export interface Sharding {
|
41
|
+
readonly [ShardingTypeId]: ShardingTypeId
|
42
|
+
readonly register: Effect.Effect<void>
|
43
|
+
readonly unregister: Effect.Effect<void>
|
44
|
+
readonly messenger: <Msg extends Message.Message.Any>(
|
45
|
+
entityType: RecipentType.EntityType<Msg>
|
46
|
+
) => Messenger<Msg>
|
47
|
+
readonly broadcaster: <Msg extends Message.Message.Any>(
|
48
|
+
topicType: RecipentType.TopicType<Msg>
|
49
|
+
) => Broadcaster<Msg>
|
50
|
+
readonly isEntityOnLocalShards: (
|
51
|
+
recipientAddress: RecipientAddress.RecipientAddress
|
52
|
+
) => Effect.Effect<boolean>
|
53
|
+
readonly isShuttingDown: Effect.Effect<boolean>
|
54
|
+
|
55
|
+
readonly registerScoped: Effect.Effect<void, never, Scope.Scope>
|
56
|
+
readonly registerEntity: <Msg extends Message.Message.Any>(
|
57
|
+
entityType: RecipentType.EntityType<Msg>
|
58
|
+
) => <R>(
|
59
|
+
behaviour: RecipientBehaviour.RecipientBehaviour<Msg, R>,
|
60
|
+
options?: RecipientBehaviour.EntityBehaviourOptions
|
61
|
+
) => Effect.Effect<void, never, Exclude<R, RecipientBehaviourContext.RecipientBehaviourContext>>
|
62
|
+
readonly registerTopic: <Msg extends Message.Message.Any>(
|
63
|
+
topicType: RecipentType.TopicType<Msg>
|
64
|
+
) => <R>(
|
65
|
+
behaviour: RecipientBehaviour.RecipientBehaviour<Msg, R>,
|
66
|
+
options?: RecipientBehaviour.EntityBehaviourOptions
|
67
|
+
) => Effect.Effect<void, never, Exclude<R, RecipientBehaviourContext.RecipientBehaviourContext>>
|
68
|
+
readonly getShardingRegistrationEvents: Stream.Stream<ShardingRegistrationEvent.ShardingRegistrationEvent>
|
69
|
+
readonly registerSingleton: <R>(name: string, run: Effect.Effect<void, never, R>) => Effect.Effect<void, never, R>
|
70
|
+
readonly assign: (shards: HashSet.HashSet<ShardId.ShardId>) => Effect.Effect<void>
|
71
|
+
readonly unassign: (shards: HashSet.HashSet<ShardId.ShardId>) => Effect.Effect<void>
|
72
|
+
readonly sendMessageToLocalEntityManagerWithoutRetries: (
|
73
|
+
message: SerializedEnvelope.SerializedEnvelope
|
74
|
+
) => Effect.Effect<
|
75
|
+
MessageState.MessageState<SerializedMessage.SerializedMessage>,
|
76
|
+
ShardingException.ShardingException
|
77
|
+
>
|
78
|
+
readonly getPods: Effect.Effect<HashSet.HashSet<PodAddress.PodAddress>>
|
79
|
+
readonly getAssignedShardIds: Effect.Effect<HashSet.HashSet<ShardId.ShardId>>
|
80
|
+
/** @internal */
|
81
|
+
readonly refreshAssignments: Effect.Effect<void, never, Scope.Scope>
|
82
|
+
/** @internal */
|
83
|
+
readonly getShardId: (recipientAddress: RecipientAddress.RecipientAddress) => ShardId.ShardId
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* @since 1.0.0
|
88
|
+
* @category context
|
89
|
+
*/
|
90
|
+
export const Tag = internal.shardingTag
|
91
|
+
|
92
|
+
/**
|
93
|
+
* @since 1.0.0
|
94
|
+
* @category layers
|
95
|
+
*/
|
96
|
+
export const live = internal.live
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Notify the shard manager that shards can now be assigned to this pod.
|
100
|
+
*
|
101
|
+
* @since 1.0.0
|
102
|
+
* @category utils
|
103
|
+
*/
|
104
|
+
export const register: Effect.Effect<void, never, Sharding> = internal.register
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Notify the shard manager that shards must be unassigned from this pod.
|
108
|
+
*
|
109
|
+
* @since 1.0.0
|
110
|
+
* @category utils
|
111
|
+
*/
|
112
|
+
export const unregister: Effect.Effect<void, never, Sharding> = internal.unregister
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Same as `register`, but will automatically call `unregister` when the `Scope` is terminated.
|
116
|
+
*
|
117
|
+
* @since 1.0.0
|
118
|
+
* @category utils
|
119
|
+
*/
|
120
|
+
export const registerScoped: Effect.Effect<void, never, Scope.Scope | Sharding> = internal.registerScoped
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Start a computation that is guaranteed to run only on a single pod.
|
124
|
+
* Each pod should call `registerSingleton` but only a single pod will actually run it at any given time.
|
125
|
+
*
|
126
|
+
* @since 1.0.0
|
127
|
+
* @category utils
|
128
|
+
*/
|
129
|
+
export const registerSingleton: <R>(
|
130
|
+
name: string,
|
131
|
+
run: Effect.Effect<void, never, R>
|
132
|
+
) => Effect.Effect<void, never, Sharding | R> = internal.registerSingleton
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Register a new entity type, allowing pods to send messages to entities of this type.
|
136
|
+
*
|
137
|
+
* @since 1.0.0
|
138
|
+
* @category utils
|
139
|
+
*/
|
140
|
+
export const registerEntity: <Msg extends Message.Message.Any>(
|
141
|
+
entityType: RecipentType.EntityType<Msg>
|
142
|
+
) => <R>(
|
143
|
+
behavior: RecipientBehaviour.RecipientBehaviour<Msg, R>,
|
144
|
+
options?: RecipientBehaviour.EntityBehaviourOptions | undefined
|
145
|
+
) => Effect.Effect<void, never, Sharding | Exclude<R, RecipientBehaviourContext.RecipientBehaviourContext>> =
|
146
|
+
internal.registerEntity
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Register a new topic type, allowing pods to broadcast messages to subscribers.
|
150
|
+
*
|
151
|
+
* @since 1.0.0
|
152
|
+
* @category utils
|
153
|
+
*/
|
154
|
+
export const registerTopic: <Msg extends Message.Message.Any>(
|
155
|
+
topicType: RecipentType.TopicType<Msg>
|
156
|
+
) => <R>(
|
157
|
+
behavior: RecipientBehaviour.RecipientBehaviour<Msg, R>,
|
158
|
+
options?: RecipientBehaviour.EntityBehaviourOptions | undefined
|
159
|
+
) => Effect.Effect<void, never, Sharding | Exclude<R, RecipientBehaviourContext.RecipientBehaviourContext>> =
|
160
|
+
internal.registerTopic
|
161
|
+
|
162
|
+
/**
|
163
|
+
* Get an object that allows sending messages to a given entity type.
|
164
|
+
* You can provide a custom send timeout to override the one globally defined.
|
165
|
+
*
|
166
|
+
* @since 1.0.0
|
167
|
+
* @category utils
|
168
|
+
*/
|
169
|
+
export const messenger: <Msg extends Message.Message.Any>(
|
170
|
+
entityType: RecipentType.EntityType<Msg>
|
171
|
+
) => Effect.Effect<Messenger<Msg>, never, Sharding> = internal.messenger
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Get an object that allows broadcasting messages to a given topic type.
|
175
|
+
* You can provide a custom send timeout to override the one globally defined.
|
176
|
+
*
|
177
|
+
* @since 1.0.0
|
178
|
+
* @category utils
|
179
|
+
*/
|
180
|
+
export const broadcaster: <Msg extends Message.Message.Any>(
|
181
|
+
topicType: RecipentType.TopicType<Msg>
|
182
|
+
) => Effect.Effect<Broadcaster<Msg>, never, Sharding> = internal.broadcaster
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Get the list of pods currently registered to the Shard Manager
|
186
|
+
*
|
187
|
+
* @since 1.0.0
|
188
|
+
* @category utils
|
189
|
+
*/
|
190
|
+
export const getPods: Effect.Effect<HashSet.HashSet<PodAddress.PodAddress>, never, Sharding> = internal.getPods
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Sends a raw message to the local entity manager without performing reties.
|
194
|
+
* Those are up to the caller.
|
195
|
+
*
|
196
|
+
* @since 1.0.0
|
197
|
+
* @category utils
|
198
|
+
*/
|
199
|
+
export const sendMessageToLocalEntityManagerWithoutRetries: (
|
200
|
+
message: SerializedEnvelope.SerializedEnvelope
|
201
|
+
) => Effect.Effect<
|
202
|
+
MessageState.MessageState<SerializedMessage.SerializedMessage>,
|
203
|
+
ShardingException.ShardingException,
|
204
|
+
Sharding
|
205
|
+
> = internal.sendMessageToLocalEntityManagerWithoutRetries
|
206
|
+
|
207
|
+
/**
|
208
|
+
* Gets the list of shardIds assigned to the current Pod
|
209
|
+
*
|
210
|
+
* @since 1.0.0
|
211
|
+
* @category utils
|
212
|
+
*/
|
213
|
+
export const getAssignedShardIds: Effect.Effect<HashSet.HashSet<ShardId.ShardId>, never, Sharding> =
|
214
|
+
internal.getAssignedShardIds
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/**
|
2
|
+
* @since 1.0.0
|
3
|
+
*/
|
4
|
+
import type * as ConfigError from "effect/ConfigError"
|
5
|
+
import type * as Context from "effect/Context"
|
6
|
+
import type * as Duration from "effect/Duration"
|
7
|
+
import type * as Layer from "effect/Layer"
|
8
|
+
import * as internal from "./internal/shardingConfig.js"
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @since 1.0.0
|
12
|
+
* @category symbols
|
13
|
+
*/
|
14
|
+
export const ShardingConfigTypeId: unique symbol = internal.ShardingConfigTypeId
|
15
|
+
|
16
|
+
/**
|
17
|
+
* @since 1.0.0
|
18
|
+
* @category symbols
|
19
|
+
*/
|
20
|
+
export type ShardingConfigTypeId = typeof ShardingConfigTypeId
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Sharding configuration
|
24
|
+
* @param numberOfShards number of shards (see documentation on how to choose this), should be same on all nodes
|
25
|
+
* @param selfHost hostname or IP address of the current pod
|
26
|
+
* @param shardingPort port used for pods to communicate together
|
27
|
+
* @param shardManagerUri url of the Shard Manager API
|
28
|
+
* @param serverVersion version of the current pod
|
29
|
+
* @param entityMaxIdleTime time of inactivity (without receiving any message) after which an entity will be interrupted
|
30
|
+
* @param entityTerminationTimeout time we give to an entity to handle the termination message before interrupting it
|
31
|
+
* @param refreshAssignmentsRetryInterval retry interval in case of failure getting shard assignments from storage
|
32
|
+
* @param unhealthyPodReportInterval interval to report unhealthy pods to the Shard Manager (this exists to prevent calling the Shard Manager for each failed message)
|
33
|
+
* @since 1.0.0
|
34
|
+
* @category models
|
35
|
+
*/
|
36
|
+
export interface ShardingConfig {
|
37
|
+
readonly numberOfShards: number
|
38
|
+
readonly selfHost: string
|
39
|
+
readonly shardingPort: number
|
40
|
+
readonly shardManagerUri: string
|
41
|
+
readonly serverVersion: string
|
42
|
+
readonly entityMaxIdleTime: Duration.Duration
|
43
|
+
readonly entityTerminationTimeout: Duration.Duration
|
44
|
+
readonly refreshAssignmentsRetryInterval: Duration.Duration
|
45
|
+
readonly unhealthyPodReportInterval: Duration.Duration
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* @since 1.0.0
|
50
|
+
* @category context
|
51
|
+
*/
|
52
|
+
export const ShardingConfig: Context.Tag<ShardingConfig, ShardingConfig> = internal.shardingConfigTag
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Provides the default values for the ShardingConfig.
|
56
|
+
*
|
57
|
+
* @since 1.0.0
|
58
|
+
* @category layers
|
59
|
+
*/
|
60
|
+
export const defaults: Layer.Layer<ShardingConfig> = internal.defaults
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Provides the ShardingConfig, values that are omitted will be read from the defaults
|
64
|
+
*
|
65
|
+
* @since 1.0.0
|
66
|
+
* @category layers
|
67
|
+
*/
|
68
|
+
export const withDefaults: (customs: Partial<ShardingConfig>) => Layer.Layer<ShardingConfig> = internal.withDefaults
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Reads the ShardingConfig from the effect/ConfigProvider
|
72
|
+
*
|
73
|
+
* @since 1.0.0
|
74
|
+
* @category layers
|
75
|
+
*/
|
76
|
+
export const fromConfig: Layer.Layer<ShardingConfig, ConfigError.ConfigError> = internal.fromConfig
|
@@ -0,0 +1,121 @@
|
|
1
|
+
/**
|
2
|
+
* @since 1.0.0
|
3
|
+
*/
|
4
|
+
import type * as HashSet from "effect/HashSet"
|
5
|
+
import type * as PodAddress from "./PodAddress.js"
|
6
|
+
import type * as ShardId from "./ShardId.js"
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @since 1.0.0
|
10
|
+
* @category models
|
11
|
+
*/
|
12
|
+
export interface ShardsAssigned {
|
13
|
+
readonly _tag: "ShardsAssigned"
|
14
|
+
readonly pod: PodAddress.PodAddress
|
15
|
+
readonly shards: HashSet.HashSet<ShardId.ShardId>
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Constructs the event that occurs when new shards are assigned to Pod.
|
20
|
+
*
|
21
|
+
* @since 1.0.0
|
22
|
+
* @category constructors
|
23
|
+
*/
|
24
|
+
export function ShardsAssigned(
|
25
|
+
pod: PodAddress.PodAddress,
|
26
|
+
shards: HashSet.HashSet<ShardId.ShardId>
|
27
|
+
): ShardsAssigned {
|
28
|
+
return { _tag: "ShardsAssigned", pod, shards }
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @since 1.0.0
|
33
|
+
* @category models
|
34
|
+
*/
|
35
|
+
export interface ShardsUnassigned {
|
36
|
+
readonly _tag: "ShardsUnassigned"
|
37
|
+
readonly pod: PodAddress.PodAddress
|
38
|
+
readonly shards: HashSet.HashSet<ShardId.ShardId>
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Constructs the event that occurs when shards are unassigned to a Pod
|
43
|
+
* @since 1.0.0
|
44
|
+
* @category constructors
|
45
|
+
*/
|
46
|
+
export function ShardsUnassigned(
|
47
|
+
pod: PodAddress.PodAddress,
|
48
|
+
shards: HashSet.HashSet<ShardId.ShardId>
|
49
|
+
): ShardsUnassigned {
|
50
|
+
return { _tag: "ShardsUnassigned", pod, shards }
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* @since 1.0.0
|
55
|
+
* @category models
|
56
|
+
*/
|
57
|
+
export interface PodHealthChecked {
|
58
|
+
readonly _tag: "PodHealthChecked"
|
59
|
+
readonly pod: PodAddress.PodAddress
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Constructs the event that occurs when the health of a Pod has been checked
|
64
|
+
*
|
65
|
+
* @since 1.0.0
|
66
|
+
* @category constructors
|
67
|
+
*/
|
68
|
+
export function PodHealthChecked(pod: PodAddress.PodAddress): PodHealthChecked {
|
69
|
+
return { _tag: "PodHealthChecked", pod }
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* @since 1.0.0
|
74
|
+
* @category models
|
75
|
+
*/
|
76
|
+
export interface PodRegistered {
|
77
|
+
readonly _tag: "PodRegistered"
|
78
|
+
readonly pod: PodAddress.PodAddress
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Constructs the event that occurs when a new Pod has registered
|
83
|
+
*
|
84
|
+
* @since 1.0.0
|
85
|
+
* @category constructors
|
86
|
+
*/
|
87
|
+
export function PodRegistered(pod: PodAddress.PodAddress): PodRegistered {
|
88
|
+
return { _tag: "PodRegistered", pod }
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* @since 1.0.0
|
93
|
+
* @category models
|
94
|
+
*/
|
95
|
+
export interface PodUnregistered {
|
96
|
+
readonly _tag: "PodUnregistered"
|
97
|
+
readonly pod: PodAddress.PodAddress
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Constructs the event that occurs when a pod has unregistered
|
102
|
+
*
|
103
|
+
* @since 1.0.0
|
104
|
+
* @category constructors
|
105
|
+
*/
|
106
|
+
export function PodUnregistered(pod: PodAddress.PodAddress): PodUnregistered {
|
107
|
+
return { _tag: "PodUnregistered", pod }
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* This are the events that may occur over the ShardManager during its lifetime.
|
112
|
+
*
|
113
|
+
* @since 1.0.0
|
114
|
+
* @category models
|
115
|
+
*/
|
116
|
+
export type ShardingEvent =
|
117
|
+
| ShardsAssigned
|
118
|
+
| ShardsUnassigned
|
119
|
+
| PodHealthChecked
|
120
|
+
| PodRegistered
|
121
|
+
| PodUnregistered
|
@@ -0,0 +1,151 @@
|
|
1
|
+
/**
|
2
|
+
* @since 1.0.0
|
3
|
+
*/
|
4
|
+
import * as Schema from "@effect/schema/Schema"
|
5
|
+
import * as PodAddress from "./PodAddress.js"
|
6
|
+
import * as RecipientAddress from "./RecipientAddress.js"
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @since 1.0.0
|
10
|
+
* @category models
|
11
|
+
*/
|
12
|
+
export class EntityNotManagedByThisPodException extends Schema.TaggedError<EntityNotManagedByThisPodException>()(
|
13
|
+
"@effect/cluster/EntityNotManagedByThisPodException",
|
14
|
+
{
|
15
|
+
recipientAddress: RecipientAddress.RecipientAddress
|
16
|
+
}
|
17
|
+
) {
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @since 1.0.0
|
22
|
+
* @category utils
|
23
|
+
*/
|
24
|
+
export const isEntityNotManagedByThisPodException = Schema.is(EntityNotManagedByThisPodException)
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @since 1.0.0
|
28
|
+
* @category models
|
29
|
+
*/
|
30
|
+
export class EntityTypeNotRegisteredException extends Schema.TaggedError<EntityTypeNotRegisteredException>()(
|
31
|
+
"@effect/cluster/EntityTypeNotRegisteredException",
|
32
|
+
{
|
33
|
+
entityType: Schema.String,
|
34
|
+
podAddress: PodAddress.schema
|
35
|
+
}
|
36
|
+
) {
|
37
|
+
}
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @since 1.0.0
|
41
|
+
* @category utils
|
42
|
+
*/
|
43
|
+
export const isEntityTypeNotRegisteredException = Schema.is(EntityTypeNotRegisteredException)
|
44
|
+
|
45
|
+
/**
|
46
|
+
* @since 1.0.0
|
47
|
+
* @category models
|
48
|
+
*/
|
49
|
+
export class NoResultInProcessedMessageStateException
|
50
|
+
extends Schema.TaggedError<NoResultInProcessedMessageStateException>()(
|
51
|
+
"@effect/cluster/NoResultInProcessedMessageStateException",
|
52
|
+
{}
|
53
|
+
)
|
54
|
+
{
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @since 1.0.0
|
59
|
+
* @category utils
|
60
|
+
*/
|
61
|
+
export const isNoResultInProcessedMessageStateException = Schema.is(NoResultInProcessedMessageStateException)
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @since 1.0.0
|
65
|
+
* @category models
|
66
|
+
*/
|
67
|
+
export class PodNoLongerRegisteredException extends Schema.TaggedError<PodNoLongerRegisteredException>()(
|
68
|
+
"@effect/cluster/PodNoLongerRegisteredException",
|
69
|
+
{
|
70
|
+
podAddress: PodAddress.schema
|
71
|
+
}
|
72
|
+
) {
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @since 1.0.0
|
77
|
+
* @category utils
|
78
|
+
*/
|
79
|
+
export const isPodNoLongerRegisteredException = Schema.is(PodNoLongerRegisteredException)
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @since 1.0.0
|
83
|
+
* @category models
|
84
|
+
*/
|
85
|
+
export class PodUnavailableException extends Schema.TaggedError<PodUnavailableException>()(
|
86
|
+
"@effect/cluster/PodUnavailableException",
|
87
|
+
{
|
88
|
+
podAddress: PodAddress.schema
|
89
|
+
}
|
90
|
+
) {
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @since 1.0.0
|
95
|
+
* @category utils
|
96
|
+
*/
|
97
|
+
export const isPodUnavailableException = Schema.is(PodUnavailableException)
|
98
|
+
|
99
|
+
/**
|
100
|
+
* @since 1.0.0
|
101
|
+
* @category models
|
102
|
+
*/
|
103
|
+
export class SerializationException extends Schema.TaggedError<SerializationException>()(
|
104
|
+
"@effect/cluster/SerializationException",
|
105
|
+
{}
|
106
|
+
) {
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* @since 1.0.0
|
111
|
+
* @category utils
|
112
|
+
*/
|
113
|
+
export const isSerializationException = Schema.is(SerializationException)
|
114
|
+
|
115
|
+
/**
|
116
|
+
* @since 1.0.0
|
117
|
+
* @category models
|
118
|
+
*/
|
119
|
+
export class ExceptionWhileOfferingMessageException
|
120
|
+
extends Schema.TaggedError<ExceptionWhileOfferingMessageException>()(
|
121
|
+
"@effect/cluster/ExceptionWhileOfferingMessageException",
|
122
|
+
{}
|
123
|
+
)
|
124
|
+
{
|
125
|
+
}
|
126
|
+
|
127
|
+
/**
|
128
|
+
* @since 1.0.0
|
129
|
+
* @category utils
|
130
|
+
*/
|
131
|
+
export const isExceptionWhileOfferingMessageException = Schema.is(ExceptionWhileOfferingMessageException)
|
132
|
+
|
133
|
+
/**
|
134
|
+
* @since 1.0.0
|
135
|
+
* @category schema
|
136
|
+
*/
|
137
|
+
export const schema = Schema.Union(
|
138
|
+
SerializationException,
|
139
|
+
EntityNotManagedByThisPodException,
|
140
|
+
EntityTypeNotRegisteredException,
|
141
|
+
PodNoLongerRegisteredException,
|
142
|
+
PodUnavailableException,
|
143
|
+
NoResultInProcessedMessageStateException,
|
144
|
+
ExceptionWhileOfferingMessageException
|
145
|
+
)
|
146
|
+
|
147
|
+
/**
|
148
|
+
* @since 1.0.0
|
149
|
+
* @category models
|
150
|
+
*/
|
151
|
+
export type ShardingException = Schema.Schema.Type<typeof schema>
|