StartShardingOptionsBuilder
Esta página aún no está disponible en tu idioma.
Defined in: src/cluster/sharding/StartShardingOptions.ts:73
Fluent builder for StartShardingOptionsType — the argument to
ClusterSharding.start. Extends ShardingOptionsBuilder so it
carries every region-side withX (typeName, entityActor, extractors,
numShards, role, proxy, rememberEntities, …) and adds the
coordinator-side fields on top.
The polymorphic fields are passed whole via a single withX(value):
allocationStrategy (AllocationStrategy), lease
(Lease), rememberEntitiesStore, and coordinatorStateStore.
Extends
Section titled “Extends”ShardingOptionsBuilder<TMessage,StartShardingOptionsType<TMessage>>
Type Parameters
Section titled “Type Parameters”TMessage
Section titled “TMessage”TMessage
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new StartShardingOptionsBuilder<
TMessage>():StartShardingOptionsBuilder<TMessage>
Returns
Section titled “Returns”StartShardingOptionsBuilder<TMessage>
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.constructor
Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
Inherited from
Section titled “Inherited from”withAcquireRetryIntervalMs()
Section titled “withAcquireRetryIntervalMs()”withAcquireRetryIntervalMs(
acquireRetryIntervalMs):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:100
Retry interval for lease.acquire() after a failed attempt. Default: 5 s.
Parameters
Section titled “Parameters”acquireRetryIntervalMs
Section titled “acquireRetryIntervalMs”number
Returns
Section titled “Returns”this
withAllocationStrategy()
Section titled “withAllocationStrategy()”withAllocationStrategy(
allocationStrategy):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:80
Strategy the coordinator uses to allocate and rebalance shards.
Parameters
Section titled “Parameters”allocationStrategy
Section titled “allocationStrategy”Returns
Section titled “Returns”this
withCoordinatorStateStore()
Section titled “withCoordinatorStateStore()”withCoordinatorStateStore(
coordinatorStateStore):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:113
Persistence backend for the coordinator’s allocation state.
Parameters
Section titled “Parameters”coordinatorStateStore
Section titled “coordinatorStateStore”CoordinatorStateStore
Returns
Section titled “Returns”this
withEntityActor()
Section titled “withEntityActor()”withEntityActor(
entityActor):this
Defined in: src/cluster/sharding/ShardingOptions.ts:133
The actor each entity instance is built from.
Parameters
Section titled “Parameters”entityActor
Section titled “entityActor”ActorClassOrFactory<TMessage>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withEntityActor
withEntityOptions()
Section titled “withEntityOptions()”withEntityOptions(
entityOptions):this
Defined in: src/cluster/sharding/ShardingOptions.ts:138
Spawn options applied to every entity of this type.
Parameters
Section titled “Parameters”entityOptions
Section titled “entityOptions”ActorOptions<TMessage>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withEntityOptions
withExtractEntityId()
Section titled “withExtractEntityId()”withExtractEntityId(
extractEntityId):this
Defined in: src/cluster/sharding/ShardingOptions.ts:143
Derive the stable entity id from an incoming message.
Parameters
Section titled “Parameters”extractEntityId
Section titled “extractEntityId”(message) => string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withExtractEntityId
withExtractEntityMessage()
Section titled “withExtractEntityMessage()”withExtractEntityMessage(
extractEntityMessage):this
Defined in: src/cluster/sharding/ShardingOptions.ts:148
Unwrap the payload actually delivered to the entity. Default: identity.
Parameters
Section titled “Parameters”extractEntityMessage
Section titled “extractEntityMessage”(message) => unknown
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withExtractEntityMessage
withHandOffTimeoutMs()
Section titled “withHandOffTimeoutMs()”withHandOffTimeoutMs(
handOffTimeoutMs):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:90
Time to wait for HandOffComplete before force-reallocating.
Parameters
Section titled “Parameters”handOffTimeoutMs
Section titled “handOffTimeoutMs”number
Returns
Section titled “Returns”this
withLease()
Section titled “withLease()”withLease(
lease):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:95
Optional split-brain protection for the coordinator (a Lease).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
withMaxEntities()
Section titled “withMaxEntities()”withMaxEntities(
maxEntities):this
Defined in: src/cluster/sharding/ShardingOptions.ts:183
Cap the number of locally-hosted entities; LRU-passivate on overflow. Default: 0 (no cap).
Parameters
Section titled “Parameters”maxEntities
Section titled “maxEntities”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withMaxEntities
withNumShards()
Section titled “withNumShards()”withNumShards(
numShards):this
Defined in: src/cluster/sharding/ShardingOptions.ts:153
Number of shards to spread entities across. Default: 64.
Parameters
Section titled “Parameters”numShards
Section titled “numShards”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withNumShards
withPassivationIdleMs()
Section titled “withPassivationIdleMs()”withPassivationIdleMs(
passivationIdleMs):this
Defined in: src/cluster/sharding/ShardingOptions.ts:173
Passivate an entity after it has been idle this many ms. Default: 5 min; 0 disables.
Parameters
Section titled “Parameters”passivationIdleMs
Section titled “passivationIdleMs”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withPassivationIdleMs
withProxy()
Section titled “withProxy()”withProxy(
proxy?):this
Defined in: src/cluster/sharding/ShardingOptions.ts:163
Run as a proxy — route messages but never host entities locally.
Parameters
Section titled “Parameters”proxy?
Section titled “proxy?”boolean = true
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withProxy
withRebalanceIntervalMs()
Section titled “withRebalanceIntervalMs()”withRebalanceIntervalMs(
rebalanceIntervalMs):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:85
Gap between coordinator-driven rebalance passes.
Parameters
Section titled “Parameters”rebalanceIntervalMs
Section titled “rebalanceIntervalMs”number
Returns
Section titled “Returns”this
withRememberEntities()
Section titled “withRememberEntities()”withRememberEntities(
rememberEntities?):this
Defined in: src/cluster/sharding/ShardingOptions.ts:168
Track entity lifecycle so entities can be re-created on the new owner.
Parameters
Section titled “Parameters”rememberEntities?
Section titled “rememberEntities?”boolean = true
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withRememberEntities
withRememberEntitiesStore()
Section titled “withRememberEntitiesStore()”withRememberEntitiesStore(
rememberEntitiesStore):this
Defined in: src/cluster/sharding/StartShardingOptions.ts:108
Persistence backend for the entity registry (only when rememberEntities).
Pass null to keep the registry in-memory only (opt out of persistence).
Parameters
Section titled “Parameters”rememberEntitiesStore
Section titled “rememberEntitiesStore”RememberEntitiesStore | null
Returns
Section titled “Returns”this
withRole()
Section titled “withRole()”withRole(
role):this
Defined in: src/cluster/sharding/ShardingOptions.ts:158
Members must carry this role to be candidates for hosting shards.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withRole
withShardPassivationIdleMs()
Section titled “withShardPassivationIdleMs()”withShardPassivationIdleMs(
shardPassivationIdleMs):this
Defined in: src/cluster/sharding/ShardingOptions.ts:178
Stop a shard once it has stood empty this many ms. Default: follows passivationIdleMs.
Parameters
Section titled “Parameters”shardPassivationIdleMs
Section titled “shardPassivationIdleMs”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withShardPassivationIdleMs
withTypeName()
Section titled “withTypeName()”withTypeName(
typeName):this
Defined in: src/cluster/sharding/ShardingOptions.ts:128
Logical name of the sharded type.
Parameters
Section titled “Parameters”typeName
Section titled “typeName”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”ShardingOptionsBuilder.withTypeName
create()
Section titled “create()”
staticcreate<TMessage>():StartShardingOptionsBuilder<TMessage>
Defined in: src/cluster/sharding/StartShardingOptions.ts:75
Start a fresh builder. Equivalent to new StartShardingOptionsBuilder<TMessage>().
Type Parameters
Section titled “Type Parameters”TMessage
Section titled “TMessage”TMessage
Returns
Section titled “Returns”StartShardingOptionsBuilder<TMessage>
