@s2-dev/streamstore - v0.22.0
    Preparing search index...

    Interface AppendSession

    Public AppendSession interface with retry, backpressure, and readable/writable streams.

    Typical lifecycle:

    1. Call S2Stream.appendSession to create a session (optionally tuning AppendSessionOptions).
    2. Submit batches with AppendSession.submit or pipe AppendInput objects into AppendSession.writable.
    3. Observe acknowledgements via AppendSession.readable / AppendSession.acks.
    4. Call AppendSession.close to flush and surface any fatal errors.
    const session = await stream.appendSession();
    const ackTicket = await session.submit(
    AppendInput.create([AppendRecord.string({ body: "event" })]),
    );
    await ackTicket.ack();
    await session.close();
    interface AppendSession {
        readable: ReadableStream<AppendAck>;
        writable: WritableStream<AppendInput>;
        "[asyncDispose]"(): PromiseLike<void>;
        acks(): AcksStream;
        close(): Promise<void>;
        failureCause(): S2Error;
        lastAckedPosition(): AppendAck;
        submit(input: AppendInput): Promise<BatchSubmitTicket>;
    }

    Hierarchy

    • AsyncDisposable
      • AppendSession
    Index

    Properties

    readable: ReadableStream<AppendAck>

    Readable stream of acknowledgements for appends.

    writable: WritableStream<AppendInput>

    Writable stream of append requests.

    Methods

    • Returns PromiseLike<void>