EventLogServer.ts
EventLogServer.ts overview
Section titled “EventLogServer.ts overview”Builds server-side handlers for the event-log remote protocol.
Transport modules use these handlers to expose an event journal to remote
replicas. The handlers run the hello/authenticate challenge flow, attach the
authenticated EventLog.Identity to later requests, accept single or chunked
writes, and stream changes back as single or chunked messages.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”chunked message state
Section titled “chunked message state”ChunkedMessageState (class)
Section titled “ChunkedMessageState (class)”Annotation that stores partial ChunkedMessage data while chunked writes are
being reassembled.
When to use
Use to keep per-client chunk assembly state while handling chunked event-log writes.
Signature
declare class ChunkedMessageStateSince v4.0.0
layers
Section titled “layers”layerAuthMiddleware
Section titled “layerAuthMiddleware”Provides RPC authentication middleware that reads the authenticated
EventLog.Identity from client annotations.
Details
Requests without an identity fail with a forbidden EventLogProtocolError.
Signature
declare const layerAuthMiddleware: Layer.Layer<EventLogAuthentication, never, never>Since v4.0.0
layerRpcHandlers
Section titled “layerRpcHandlers”Creates the shared RPC handlers for the event-log remote protocol.
Details
The layer manages hello challenges, verifies session authentication, reassembles chunked writes, delegates write and change handling to the supplied callbacks, and frames large change payloads into chunks.
Signature
declare const layerRpcHandlers: (options: { readonly remoteId: RemoteId readonly getOrCreateSessionAuthBinding: ( publicKey: string, signingPublicKey: Uint8Array<ArrayBuffer> ) => Effect.Effect<Uint8Array<ArrayBuffer>> readonly onWrite: (data: Uint8Array<ArrayBuffer>) => Effect.Effect<void, EventLogProtocolError> readonly changes: (options: { readonly publicKey: string readonly storeId: StoreId readonly startSequence: number }) => Stream.Stream<Uint8Array<ArrayBuffer>, unknown>}) => Layer.Layer<Rpc.ToHandler<RpcGroup.Rpcs<typeof EventLogRemoteRpcs>> | EventLogAuthentication>Since v4.0.0