import type { GetBlockProgressEvents } from './blocks.ts'; import type { GraphWalkerFactory } from './graph-walker.ts'; import type { AbortOptions } from 'abort-error'; import type { CID } from 'multiformats/cid'; import type { ProgressEvent, ProgressOptions } from 'progress-events'; export type PinType = 'recursive' | 'direct' | 'indirect'; export interface Pin { cid: CID; depth: number; metadata: Record; } export type AddPinEvents = ProgressEvent<'helia:pin:add', CID>; export interface AddOptions extends AbortOptions, ProgressOptions { /** * How deeply to pin the DAG, defaults to Infinity */ depth?: number; /** * Walker factory used to traverse the DAG. Default: `depthFirstWalker()`. */ walker?: GraphWalkerFactory; /** * Optional user-defined metadata to store with the pin */ metadata?: Record; } export interface RmOptions extends AbortOptions { /** * Walker factory used to traverse the DAG. Default: `depthFirstWalker()`. */ walker?: GraphWalkerFactory; } export interface LsOptions extends AbortOptions { cid?: CID; } export interface IsPinnedOptions extends AbortOptions { } export interface Pins { /** * Pin a block in the blockstore. It will not be deleted when garbage * collection is run. */ add(cid: CID, options?: AddOptions): AsyncGenerator; /** * Unpin the block that corresponds to the passed CID. The block will be * deleted when garbage collection is run. */ rm(cid: CID, options?: RmOptions): AsyncGenerator; /** * List all blocks that have been pinned. */ ls(options?: LsOptions): AsyncGenerator; /** * If the CID is pinned, return details of the pin, otherwise throw an error */ get(cid: CID, options?: AbortOptions): Promise; /** * Return true if the passed CID is pinned */ isPinned(cid: CID, options?: IsPinnedOptions): Promise; /** * If the CID is pinned, update the metadata associated with the pin, * otherwise throw an error */ setMetadata(cid: CID, metadata: Record | undefined, options?: AbortOptions): Promise; } //# sourceMappingURL=pins.d.ts.map