UNPKG

@dstanesc/o-o-o-o-o-o-o

Version:

O-O-O-O-O-O-O is a collection of content addressed persistent data structures

60 lines 2.05 kB
import { BlockStore } from './block-store'; import { LinkCodec, ValueCodec } from './codecs'; import { Tx } from './graph'; import { GraphStore } from './graph-store'; import { Signer } from './trust'; import { RootIndex, Link, Vertex, Block, Tag, Comment } from './types'; import { VersionStore } from './version-store'; interface ItemList { tx: () => ItemListTransaction; get: (index: number) => Promise<Item>; range: (startIndex: number, itemCount: number) => Promise<Item[]>; length: () => Promise<number>; } type ItemValue = Map<number, any>; interface ItemRef { index: number; offset: number; } interface Item { value: ItemValue; ref: ItemRef; } declare const itemListFactory: (versionStore: VersionStore, graphStore: GraphStore) => ItemList; declare class ItemListTransaction { tx: Tx; current: Vertex | undefined; constructor(tx: Tx); push(item: ItemValue): Promise<ItemRef>; start(): Promise<ItemListTransaction>; commit({ comment, tags, signer, }: { comment?: Comment; tags?: Tag[]; signer?: Signer; }): Promise<{ root: Link; index: RootIndex; blocks: Block[]; }>; } declare const readonlyItemList: ({ versionRoot, chunk, linkCodec, valueCodec, blockStore, }: { versionRoot: Link; chunk: (buffer: Uint8Array) => Uint32Array; linkCodec: LinkCodec; valueCodec: ValueCodec; blockStore: BlockStore; }) => Promise<ItemList>; declare const mergeItemLists: ({ baseRoot, baseStore, currentRoot, currentStore, otherRoot, otherStore, }: { baseRoot: Link; baseStore: BlockStore; currentRoot: Link; currentStore: BlockStore; otherRoot: Link; otherStore: BlockStore; }, chunk: (buffer: Uint8Array) => Uint32Array, linkCodec: LinkCodec, valueCodec: ValueCodec) => Promise<{ root: Link; index: RootIndex; blocks: Block[]; }>; export { ItemList, ItemValue, ItemRef, Item, ItemListTransaction, itemListFactory, readonlyItemList, mergeItemLists, }; //# sourceMappingURL=item-list.d.ts.map