Skip to content

registerObjectStoragePlugins

registerObjectStoragePlugins(ext, options): Promise<ObjectStoragePluginHandles>

Defined in: src/persistence/object-storage/ObjectStoragePlugin.ts:102

Register the object-storage SnapshotStore against PersistenceExtension and return a ready-to-use DurableStateStore instance. Mirrors the Cassandra plugin’s one-call wiring while accepting that DurableState isn’t extension-managed today — callers who want DurableState read handles.durableStateStore from the return value and pass it into their DurableStateActor settings.

Eager peer-dep validation (#18, #59). Before returning, this function probes any optional peer-dependency the configured codecs need — fzstd for compression: 'zstd' (when neither Bun nor Node 22.15+ provides a native impl), SubtleCrypto when any encryption config is supplied. A failing probe surfaces the “install X” message here, at registration time, instead of silently surviving until the first persist call. For resolvers built via compressionByPrefix / encryptionByPrefix every config the resolver could return is probed; opaque user-written resolvers fall back to first-use checks.

Example:

const ext = system.extension(PersistenceExtensionId); const { durableStateStore } = await registerObjectStoragePlugins(ext, { backend: { kind: ‘s3’, bucket: ‘my-app’, region: ‘eu-central-1’ }, compression: { algorithm: ‘zstd’ }, encryption: encryptionByPrefix({ default: { mode: ‘sse-s3’ } }), }); // … and to make the snapshot plugin active: // actor-ts.persistence.snapshot-store.plugin = “actor-ts.persistence.snapshot-store.object-storage”

PersistenceExtension

ObjectStoragePluginOptions

Promise<ObjectStoragePluginHandles>