UNPKG

ipfs-core

Version:

JavaScript implementation of the IPFS specification

101 lines 4.5 kB
/** * @typedef {import('interface-blockstore').Blockstore} Blockstore * @typedef {import('interface-blockstore').Query} Query * @typedef {import('interface-blockstore').KeyQuery} KeyQuery * @typedef {import('multiformats/cid').CID} CID * @typedef {import('ipfs-bitswap').IPFSBitswap} Bitswap * @typedef {import('ipfs-core-types/src/utils').AbortOptions} AbortOptions * @typedef {import('ipfs-core-types/src/block').RmOptions} RmOptions */ /** * BlockStorage 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. * * @implements {Blockstore} */ export class BlockStorage extends BaseBlockstore implements Blockstore { /** * Create a new BlockStorage * * @param {Blockstore} blockstore * @param {Bitswap} bitswap */ constructor(blockstore: Blockstore, bitswap: Bitswap); child: import("interface-blockstore").Blockstore; bitswap: import("ipfs-bitswap/dist/src/types").IPFSBitswap; unwrap(): import("interface-blockstore").Blockstore; /** * Put a block to the underlying datastore * * @param {CID} cid * @param {Uint8Array} block * @param {AbortOptions} [options] */ put(cid: CID, block: Uint8Array, options?: import("ipfs-core-types/src/utils").AbortOptions | undefined): Promise<void>; /** * Put a multiple blocks to the underlying datastore * * @param {AsyncIterable<{ key: CID, value: Uint8Array }> | Iterable<{ key: CID, value: Uint8Array }>} blocks * @param {AbortOptions} [options] */ putMany(blocks: AsyncIterable<{ key: CID; value: Uint8Array; }> | Iterable<{ key: CID; value: Uint8Array; }>, options?: import("ipfs-core-types/src/utils").AbortOptions | undefined): AsyncGenerator<import("interface-store/dist/src").Pair<import("multiformats/cid").CID<unknown, number, number, import("multiformats/cid").Version>, Uint8Array>, void, undefined>; /** * Get a block by cid * * @param {CID} cid * @param {AbortOptions} [options] */ get(cid: CID, options?: import("ipfs-core-types/src/utils").AbortOptions | undefined): Promise<Uint8Array>; /** * Get multiple blocks back from an array of cids * * @param {AsyncIterable<CID> | Iterable<CID>} cids * @param {AbortOptions} [options] */ getMany(cids: AsyncIterable<CID> | Iterable<CID>, options?: import("ipfs-core-types/src/utils").AbortOptions | undefined): AsyncGenerator<Uint8Array, void, undefined>; /** * Delete a block from the blockstore * * @param {CID} cid * @param {RmOptions} [options] */ delete(cid: CID, options?: import("ipfs-core-types/src/block").RmOptions | undefined): Promise<void>; /** * Delete multiple blocks from the blockstore * * @param {AsyncIterable<CID> | Iterable<CID>} cids * @param {RmOptions} [options] */ deleteMany(cids: AsyncIterable<CID> | Iterable<CID>, options?: import("ipfs-core-types/src/block").RmOptions | undefined): AsyncGenerator<import("multiformats/cid").CID<unknown, number, number, import("multiformats/cid").Version>, void, undefined>; /** * @param {CID} cid * @param {AbortOptions} options */ has(cid: CID, options?: AbortOptions): Promise<boolean>; /** * @param {Query} q * @param {AbortOptions} options */ query(q: Query, options?: AbortOptions): AsyncGenerator<import("interface-store/dist/src").Pair<import("multiformats/cid").CID<unknown, number, number, import("multiformats/cid").Version>, Uint8Array>, void, undefined>; /** * @param {KeyQuery} q * @param {AbortOptions} options */ queryKeys(q: KeyQuery, options?: AbortOptions): AsyncGenerator<import("multiformats/cid").CID<unknown, number, number, import("multiformats/cid").Version>, void, undefined>; } export type Blockstore = import('interface-blockstore').Blockstore; export type Query = import('interface-blockstore').Query; export type KeyQuery = import('interface-blockstore').KeyQuery; export type CID = import('multiformats/cid').CID; export type Bitswap = import('ipfs-bitswap').IPFSBitswap; export type AbortOptions = import('ipfs-core-types/src/utils').AbortOptions; export type RmOptions = import('ipfs-core-types/src/block').RmOptions; import { BaseBlockstore } from "blockstore-core"; //# sourceMappingURL=block-storage.d.ts.map