export = BlockService; /** * @typedef {import('ipfs-repo')} IPFSRepo * @typedef {import('ipld-block')} Block * @typedef {import('cids')} CID */ /** * BlockService is a hybrid block datastore. It stores data in a local * datastore and may retrieve data from a remote Exchange. * It uses an internal `datastore.Datastore` instance to store values. */ declare class BlockService { /** * Create a new BlockService * * @param {IPFSRepo} ipfsRepo */ constructor(ipfsRepo: IPFSRepo); _repo: import("ipfs-repo"); _bitswap: any; /** * Add a bitswap instance that communicates with the * network to retreive blocks that are not in the local store. * * If the node is online all requests for blocks first * check locally and afterwards ask the network for the blocks. * * @param {any} bitswap */ setExchange(bitswap: any): void; /** * Go offline, i.e. drop the reference to bitswap. */ unsetExchange(): void; /** * Is the blockservice online, i.e. is bitswap present. */ hasExchange(): boolean; /** * Put a block to the underlying datastore. * * @param {Block} block * @param {object} [options] - Options is an object with the following properties * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation * @returns {Promise} */ put(block: Block, options?: { signal?: AbortSignal | undefined; } | undefined): Promise; /** * Put a multiple blocks to the underlying datastore. * * @param {AsyncIterable | Iterable} blocks * @param {object} [options] - Options is an object with the following properties * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation * @returns {AsyncIterable} */ putMany(blocks: AsyncIterable | Iterable, options?: { signal?: AbortSignal | undefined; } | undefined): AsyncIterable; /** * Get a block by cid. * * @param {CID} cid * @param {object} [options] - Options is an object with the following properties * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation * @returns {Promise} */ get(cid: CID, options?: { signal?: AbortSignal | undefined; } | undefined): Promise; /** * Get multiple blocks back from an array of cids. * * @param {AsyncIterable | Iterable} cids * @param {object} [options] - Options is an object with the following properties * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation * @returns {AsyncIterable} */ getMany(cids: AsyncIterable | Iterable, options?: { signal?: AbortSignal | undefined; } | undefined): AsyncIterable; /** * Delete a block from the blockstore. * * @param {CID} cid * @param {object} [options] - Options is an object with the following properties * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation */ delete(cid: CID, options?: { signal?: AbortSignal | undefined; } | undefined): Promise; /** * Delete multiple blocks from the blockstore. * * @param {AsyncIterable | Iterable} cids * @param {object} [options] - Options is an object with the following properties * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation */ deleteMany(cids: AsyncIterable | Iterable, options?: { signal?: AbortSignal | undefined; } | undefined): AsyncIterable; } declare namespace BlockService { export { IPFSRepo, Block, CID }; } type Block = import("ipld-block"); type CID = import("cids"); type IPFSRepo = import("ipfs-repo"); //# sourceMappingURL=index.d.ts.map