S3Storage
Defined in: src/session/s3-storage.ts:46
S3-based implementation of SnapshotStorage. Persists session snapshots as JSON objects in an S3 bucket.
Object key layout:
[<prefix>/]<sessionId>/scopes/<scope>/<scopeId>/snapshots/ snapshot_latest.json immutable_history/ snapshot_<uuid7>.jsonImplements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new S3Storage(config): S3Storage;Defined in: src/session/s3-storage.ts:57
Creates new S3Storage instance
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
config | S3StorageConfig | Configuration options |
Returns
Section titled “Returns”S3Storage
Methods
Section titled “Methods”saveSnapshot()
Section titled “saveSnapshot()”saveSnapshot(params): Promise<void>;Defined in: src/session/s3-storage.ts:93
Persists a snapshot to S3.
If isLatest is true, writes to snapshot_latest.json (overwriting any previous).
Otherwise, writes to immutable_history/snapshot_<snapshotId>.json.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { location: SnapshotLocation; snapshotId: string; isLatest: boolean; snapshot: Snapshot; } |
params.location | SnapshotLocation |
params.snapshotId | string |
params.isLatest | boolean |
params.snapshot | Snapshot |
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”loadSnapshot()
Section titled “loadSnapshot()”loadSnapshot(params): Promise<Snapshot>;Defined in: src/session/s3-storage.ts:111
Loads a snapshot from S3.
If snapshotId is omitted, loads snapshot_latest.json.
Returns null if the object does not exist.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { location: SnapshotLocation; snapshotId?: string; } |
params.location | SnapshotLocation |
params.snapshotId? | string |
Returns
Section titled “Returns”Promise<Snapshot>
Implementation of
Section titled “Implementation of”listSnapshotIds()
Section titled “listSnapshotIds()”listSnapshotIds(params): Promise<string[]>;Defined in: src/session/s3-storage.ts:126
Lists immutable snapshot IDs for a scope, sorted chronologically.
Since IDs are UUID v7, lexicographic sort equals chronological order.
Pushes startAfter and limit down to S3 via StartAfter and MaxKeys
to avoid fetching unnecessary objects.
Returns an empty array if no snapshots exist yet.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { location: SnapshotLocation; limit?: number; startAfter?: string; } |
params.location | SnapshotLocation |
params.limit? | number |
params.startAfter? | string |
Returns
Section titled “Returns”Promise<string[]>
Implementation of
Section titled “Implementation of”SnapshotStorage.listSnapshotIds
deleteSession()
Section titled “deleteSession()”deleteSession(params): Promise<void>;Defined in: src/session/s3-storage.ts:180
Deletes all S3 objects belonging to a session by listing and batch-deleting
everything under [<prefix>/]<sessionId>/.
Handles buckets with more than 1000 objects via continuation token pagination.
No-ops if the session has no objects.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { sessionId: string; } |
params.sessionId | string |
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”loadManifest()
Section titled “loadManifest()”loadManifest(params): Promise<SnapshotManifest>;Defined in: src/session/s3-storage.ts:203
Loads the snapshot manifest for a scope from S3. Returns a default manifest with the current timestamp if none exists yet.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { location: SnapshotLocation; } |
params.location | SnapshotLocation |
Returns
Section titled “Returns”Promise<SnapshotManifest>
Implementation of
Section titled “Implementation of”saveManifest()
Section titled “saveManifest()”saveManifest(params): Promise<void>;Defined in: src/session/s3-storage.ts:218
Persists the snapshot manifest for a scope to S3.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { location: SnapshotLocation; manifest: SnapshotManifest; } |
params.location | SnapshotLocation |
params.manifest | SnapshotManifest |
Returns
Section titled “Returns”Promise<void>