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

97 lines 3.63 kB
import { BlockStore } from './block-store'; import { LinkCodec, ValueCodec } from './codecs'; import { Block, Link, RootIndex } from './types'; import { Graph } from './graph'; /** * The GraphPacker is responsible for packing and unpacking complete graph versions or fragments thereof in a single large block. */ interface GraphPacker { /** * Extract all blocks that make up a complete graph version. */ extractVersionBlocks: ({ root, index }: { root: Link; index?: RootIndex; }, fromStore: BlockStore) => Promise<Block[]>; /** * Packs a complete graph story into a single block. */ packVersionStore: (versionStoreRoot: Link, fromStore: BlockStore, chunk: (buffer: Uint8Array) => Uint32Array, valueCodec: ValueCodec) => Promise<Block>; /** * Packs a complete graph version into a single block. * @deprecated */ packGraph: (versionRoot: Link, fromStore: BlockStore) => Promise<Block>; /** * Packs a complete graph version into a single block. */ packGraphVersion: (versionRoot: Link, fromStore: BlockStore) => Promise<Block>; /** * Packs a complete root index into a single block. */ packRootIndex: (versionRoot: Link, fromStore: BlockStore) => Promise<Block>; /** * Packs the commit results into a single block. */ packCommit: ({ root, index, blocks, }: { root: Link; index: RootIndex; blocks: Block[]; }) => Promise<Block>; /** * Packs a vertex data slice together with the derived edge and property data into a single block. */ packComputed: (versionRoot: Link, vertexOffsetStart: number, vertexCount: number, graphDepth: number, fromStore: BlockStore, chunk: (buffer: Uint8Array) => Uint32Array, valueCodec: ValueCodec) => Promise<Block>; /** * Packs a vertex data slice together with the derived edge and property data into a single block. Graph API friendly. */ packFragment: (graph: Graph, versionRoot: Link, vertexOffsetStart: number, vertexCount: number, graphDepth: number, fromStore: BlockStore) => Promise<Block>; /** * Unpacks and restores packed graph data into a block store. * @deprecated */ restore: (pack: Uint8Array, intoStore: BlockStore) => Promise<{ root: Link; index: RootIndex; blocks: Block[]; }>; /** * Restores a packed graph version into a block store. * @see packGraphVersion */ restoreGraphVersion: (pack: Uint8Array, intoStore: BlockStore) => Promise<{ root: Link; index: RootIndex; blocks: Block[]; }>; /** * Unpacks and restores single index data into a block store. */ restoreSingleIndex: (packBytes: Uint8Array, intoStore: BlockStore) => Promise<{ root: Link; index: { startOffsets: Map<number, any>; indexSize: number; byteArraySize: number; }; blocks: Block[]; }>; restoreRootIndex: (packBytes: Uint8Array, intoStore: BlockStore) => Promise<{ root: Link; index: RootIndex; blocks: Block[]; }>; /** * Unpacks graph packed data */ unpack: (pack: Uint8Array) => Promise<{ root: Link; index: RootIndex; blocks: Block[]; }>; packRandomBlocks: (blocks: Block[]) => Promise<Block>; restoreRandomBlocks: (pack: Uint8Array, intoStore: BlockStore) => Promise<Block[]>; } declare const graphPackerFactory: (linkCodec: LinkCodec) => GraphPacker; export { graphPackerFactory, GraphPacker }; //# sourceMappingURL=graph-packer.d.ts.map