filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
61 lines • 2.03 kB
TypeScript
import { EventEmitter } from 'node:events';
import type { Blockstore } from 'interface-blockstore';
import type { AbortOptions, AwaitIterable } from 'interface-store';
import { CID } from 'multiformats/cid';
import type { Logger } from 'pino';
export interface CARBlockstoreStats {
blocksWritten: number;
missingBlocks: Set<string>;
totalSize: number;
startTime: number;
finalized: boolean;
}
export interface CARBlockstoreOptions {
rootCID: CID;
outputPath: string;
logger?: Logger;
}
export declare class CARWritingBlockstore extends EventEmitter implements Blockstore {
private readonly rootCID;
private readonly outputPath;
private readonly blockOffsets;
private readonly stats;
private readonly logger;
private carWriter;
private writeStream;
private currentOffset;
private finalized;
private pipelinePromise;
constructor(options: CARBlockstoreOptions);
initialize(): Promise<void>;
put(cid: CID, block: Uint8Array, _options?: AbortOptions): Promise<CID>;
get(cid: CID, _options?: AbortOptions): Promise<Uint8Array>;
has(cid: CID, _options?: AbortOptions): Promise<boolean>;
delete(_cid: CID, _options?: AbortOptions): Promise<void>;
putMany(source: AwaitIterable<{
cid: CID;
block: Uint8Array;
}>, _options?: AbortOptions): AsyncIterable<CID>;
getMany(source: AwaitIterable<CID>, _options?: AbortOptions): AsyncIterable<{
cid: CID;
block: Uint8Array;
}>;
deleteMany(_source: AwaitIterable<CID>, _options?: AbortOptions): AsyncIterable<CID>;
getAll(_options?: AbortOptions): AsyncIterable<{
cid: CID;
block: Uint8Array;
}>;
/**
* Finalize the CAR file and return statistics
*/
finalize(): Promise<CARBlockstoreStats>;
/**
* Get current statistics
*/
getStats(): CARBlockstoreStats;
/**
* Clean up resources (called on errors)
*/
cleanup(): Promise<void>;
}
//# sourceMappingURL=car-blockstore.d.ts.map