linkdex
Version:
An index mapping block CID to linked block CID.
42 lines • 1.6 kB
TypeScript
/**
* @typedef {object} HashReport
* @property {number} hashPassed How many CIDs were verified as matching block bytes.
* @property {number} hashFailed How many CIDs failed verification that they matched block bytes.
* @property {number} hashUnknown How many CIDs could not be verified because the hashing function was unknown.
*/
/**
* A link indexer that also verifies that block bytes hash to their reported CID.
*/
export class HashingLinkIndexer extends LinkIndexer {
hashPassed: number;
hashFailed: number;
hashUnknown: number;
/**
* Hash the block bytes to verify the CID matches, decode the block and index
* any CIDs the block links to.
* @param {import('@ipld/car/api').Block} block
* @param {object} [opts]
* @param {import('./decode').BlockDecoders} [opts.codecs] - bring your own codecs
*/
decodeAndIndex({ cid, bytes }: import('@ipld/car/api').Block, opts?: {
codecs?: import("./decode").BlockDecoders | undefined;
} | undefined): void | Promise<void>;
/** @returns {import('./index').Report & HashReport} */
report(): import('./index').Report & HashReport;
}
export type HashReport = {
/**
* How many CIDs were verified as matching block bytes.
*/
hashPassed: number;
/**
* How many CIDs failed verification that they matched block bytes.
*/
hashFailed: number;
/**
* How many CIDs could not be verified because the hashing function was unknown.
*/
hashUnknown: number;
};
import { LinkIndexer } from "./index.js";
//# sourceMappingURL=hashing-indexer.d.ts.map