Skip to content

SqlEventLogServerUnencrypted

SQL-backed storage for unencrypted event-log servers.

This module provides the durable Storage implementation used by EventLogServerUnencrypted when remote entries should be stored in a SQL database and streamed back to clients by store sequence. It creates dialect-specific tables for the server remote id, per-store sequence state, plaintext entries, and session authentication bindings.

2 exports Added in v4.0.0 Source

Constructors

makeStorage

Added in v4.0.0 Source

Creates unencrypted event-log server Storage backed by SQL.

Details

The implementation creates tables for the server remote id, store sequences, entries, and session authentication bindings, then persists and streams plaintext remote entries.

Signature

declare function makeStorage(options?: {
  readonly entryTablePrefix?: string;
  readonly insertBatchSize?: number;
  readonly remoteIdTable?: string;
}): Effect<{
  readonly changes: (options: {
    readonly compactors: ReadonlyMap<string, RegisteredCompactor>;
    readonly startSequence: number;
    readonly storeId: StoreId;
  }) => Stream<RemoteEntry>;
  readonly entriesAfter: (storeId: StoreId, entry: Entry) => Effect<Array<Entry>>;
  readonly getId: Effect<RemoteId>;
  readonly getOrCreateSessionAuthBinding: (publicKey: string, signingPublicKey: Uint8Array<ArrayBuffer>) => Effect<Uint8Array<ArrayBuffer>>;
  readonly withTransaction: <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R>;
  readonly write: (storeId: StoreId, entries: readonly Array<Entry>) => Effect<readonly Array<RemoteEntry>>;
}, SqlError, Scope | SqlClient>

Layers

layerStorage

Added in v4.0.0 Source

Provides unencrypted server Storage using the SQL-backed implementation.

Signature

declare function layerStorage(options?: {
  readonly entryTablePrefix?: string;
  readonly insertBatchSize?: number;
  readonly remoteIdTable?: string;
}): Layer<Storage, SqlError, SqlClient>;