UNPKG

@x5e/gink

Version:

an eventually consistent database

35 lines (34 loc) 1.48 kB
import { Muid, BundleInfo, Medallion, Timestamp, BundleView, BundleBytes, KeyPair, Bytes } from "./typedefs"; import { BundleBuilder, ChangeBuilder, EntryBuilder, ContainerBuilder } from "./builders"; export declare class Bundler implements BundleView { private pendingComment?; readonly preAssignedMedallion?: Medallion; private bundleInfo?; private bundleBytes?; private bundleBuilder; private countItems; constructor(pendingComment?: string, preAssignedMedallion?: Medallion); private requireNotSealed; get info(): BundleInfo; get bytes(): BundleBytes; get builder(): BundleBuilder; set comment(value: string | undefined); get comment(): string | undefined; get medallion(): Medallion | undefined; get timestamp(): Timestamp | undefined; addEntry(entryBuilder: EntryBuilder): Muid; addContainer(containerBuilder: ContainerBuilder): Muid; /** * * @param changeBuilder a protobuf Change ready to be serialized * @returns an Address who's offset is immediately available and whose medallion and * timestamp become defined when this Bundle is sealed. */ addChange(changeBuilder: ChangeBuilder): Muid; /** * Intended to be called by a Database to finalize a bundle. * @param bundleInfo the bundle metadata to add when serializing * @returns serialized */ seal(bundleInfo: BundleInfo, keyPair: KeyPair, priorHash?: Bytes, identity?: string): void; }