/// import CID from 'cids'; import { Query, Key, Datastore, Result } from 'interface-datastore'; /** * Block represents an immutable block of data that is uniquely referenced with a cid. * * It satisfies the default IPFS IPLD block interface: https://github.com/ipld/js-ipld-block. */ export declare class Block { readonly data: Buffer; readonly cid: CID; /** * Block creates an immutable block of data with the given content identifier (CID). * * @param {Buffer} data The data to be stored in the block as a buffer. * @param {CID} cid The content identifier of the data. */ constructor(data: Buffer, cid: CID); } /** * BlockStore is a simple key/value store for adding, deleting, and retrieving immutable blocks of data. * * It satisfies the default IPFS block store interface: https://github.com/ipfs/js-ipfs-repo. */ export declare class BlockStore { private store; /** * BlockStore creates a new block store. * * @param {Datastore} store The underlying datastore for locally caching immutable blocks of data. */ constructor(store: Datastore); /** * cidToKey transforms a CID to the appropriate block store key. * * @param {CID} cid The content identifier for an immutable block of data. */ static cidToKey: (cid: CID) => Key; /** * keyToCid transforms a block store key to a CID. * * @param {Key} key The key used to encode the CID. */ static keyToCid: (key: Key) => CID; /** * put adds a block to the block store. * * @param {Block} block An immutable block of data. */ put(block: Block): Promise; /** * putMany adds multiple blocks to the store. * * @param {Iterable} blocks An iterable of immutable blocks of data. */ putMany(blocks: Iterable): Promise; /** * get returns a block by cid. * * @param {CID} cid The content identifier for an immutable block of data. */ get(cid: CID): Promise; /** * delete removes a block from the store. * * @param {CID} cid The content identifier for an immutable block of data. */ delete(cid: CID): Promise; /** * has returns whether the store contains the block associated with the given CID. * * @param {CID} cid The content identifier for an immutable block of data. */ has(cid: CID): Promise; /** * query searches the store for blocks matching the query parameters. It returns results from the underlying * datastore (i.e., not Blocks). * * @param {Query} query A set of query options to use when querying the underlying datastore. */ query(query: Query): AsyncIterableIterator; }