UNPKG

@fairdatasociety/fdp-lokijs-adapter

Version:
32 lines (31 loc) 1.17 kB
import { FdpStorage } from '@fairdatasociety/fdp-storage'; import { BeeSon } from '@fairdatasociety/beeson'; import { JsonValue } from '@fairdatasociety/beeson/dist/types'; import { Reference } from '@ethersphere/swarm-cid'; import { CID } from 'multiformats/cid'; import { FeedDB } from './feeddb'; import { FeedSequencerOptions } from './feedsequencer'; export interface SaveDatabaseCallbackArgs { reference: Reference; cid: CID; } export interface LoadDatabaseCallbackArgs { data: BeeSon<JsonValue>; } /** * Get CID from Beeson helper * @param beeson beeson value * @returns A CID */ export declare function getCidFromBeeson(beeson: BeeSon<JsonValue>): Promise<CID>; /** * fdp storage Loki DB Adapter */ export declare class LokiFDPAdapter { private fdp; private options; db: FeedDB; constructor(fdp: FdpStorage, dbname: string, options: FeedSequencerOptions); saveDatabase(key: string, value: BeeSon<JsonValue>, callback: (err: Error | null, args?: SaveDatabaseCallbackArgs) => void): Promise<void>; loadDatabase(dbname: string, callback: (err: Error | null, args?: LoadDatabaseCallbackArgs) => void): Promise<void>; }