UNPKG

@actyx/sdk

Version:
45 lines (44 loc) 1.57 kB
import { Offset, StreamId } from './various'; /** * A offset map stores the high water mark for each source. * * The value in the psn map is the highest psn seen for this source. Since sequence * numbers start with 0, the default value for sources that are not present is -1 * * @public */ export declare type OffsetMap = Record<StreamId, Offset>; /** * Response to an offsets() call * @public */ export declare type OffsetsResponse = { /** The current local present, i.e. offsets up to which we can provide events without any gaps. */ present: OffsetMap; /** For each stream we still need to download events from, the number of pending events. */ toReplicate: Record<StreamId, number>; }; /** Anything with offset on a stream. * @public */ export declare type HasOffsetAndStream = { offset: number; stream: string; }; /** * Relatively pointless attempt to distinguish between mutable and immutable psnmap * See https://github.com/Microsoft/TypeScript/issues/13347 for why this does not help much. * @public */ export declare type OffsetMapBuilder = Record<string, Offset>; /** OffsetMap companion functions. * @public */ export declare type OffsetMapCompanion = { empty: OffsetMap; isEmpty: (m: OffsetMap) => boolean; lookup: (m: OffsetMap, s: string) => Offset; lookupOrUndefined: (m: OffsetMap, s: string) => Offset | undefined; update: (m: OffsetMapBuilder, ev: HasOffsetAndStream) => OffsetMapBuilder; }; /** OffsetMap companion functions. * @public */ export declare const OffsetMap: OffsetMapCompanion;