import { NotFoundError } from 'interface-store' import { BaseBlockstore } from './base.ts' import type { Pair } from 'interface-blockstore' import type { AbortOptions, Await, AwaitGenerator, AwaitIterable } from 'interface-store' import type { CID } from 'multiformats/cid' export class BlackHoleBlockstore extends BaseBlockstore { put (key: CID, value: Uint8Array | AwaitIterable, options?: AbortOptions): Await { options?.signal?.throwIfAborted() return key } get (key: CID, options?: AbortOptions): AwaitGenerator { options?.signal?.throwIfAborted() throw new NotFoundError() } has (key: CID, options?: AbortOptions): Await { options?.signal?.throwIfAborted() return false } async delete (cid: CID, options?: AbortOptions): Promise { options?.signal?.throwIfAborted() } // eslint-disable-next-line require-yield async * getAll (options?: AbortOptions): AwaitGenerator { options?.signal?.throwIfAborted() } }