Helia
    Preparing search index...

    Interface BlockStorage

    BlockStorage is a hybrid blockstore that puts/gets blocks from a configured blockstore (that may be on disk, s3, or something else). If the blocks are not present Bitswap will be used to fetch them from network peers.

    interface BlockStorage {
        lock: Mortice;
        createSession(root: CID, options?: AbortOptions): SessionBlockstore;
        delete(
            cid: CID,
            options?: AbortOptions & ProgressOptions<DeleteBlockProgressEvents>,
        ): Promise<void>;
        deleteMany(
            cids: AwaitIterable<CID<unknown, number, number, Version>>,
            options?: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents>,
        ): AsyncIterable<CID<unknown, number, number, Version>>;
        get(
            cid: CID,
            options?: GetOfflineOptions & AbortOptions & ProgressOptions<
                GetBlockProgressEvents,
            >,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        getAll(
            options?: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents>,
        ): AsyncIterable<Pair>;
        getMany(
            cids: AwaitIterable<CID<unknown, number, number, Version>>,
            options?: GetOfflineOptions & AbortOptions & ProgressOptions<
                GetManyBlocksProgressEvents,
            >,
        ): AsyncIterable<Pair>;
        has(cid: CID, options?: AbortOptions): Promise<boolean>;
        isStarted(): boolean;
        put(
            cid: CID,
            block: Uint8Array,
            options?: AbortOptions & ProgressOptions<PutBlockProgressEvents>,
        ): Promise<CID<unknown, number, number, Version>>;
        putMany(
            blocks: AwaitIterable<{ block: Uint8Array; cid: CID }>,
            options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>,
        ): AsyncIterable<CID<unknown, number, number, Version>>;
        start(): Promise<void>;
        stop(): Promise<void>;
        unwrap(): Blockstore;
    }

    Implements

    Index

    Properties

    lock: Mortice

    Methods

    • Check for the existence of a value for the passed key

      Parameters

      Returns Promise<boolean>

      const exists = await store.has(new Key('awesome'))

      if (exists) {
      console.log('it is there')
      } else {
      console.log('it is not there')
      }
    • This method will be invoked to start the component.

      It should not assume that any other components have been started.

      Returns Promise<void>

    • This method will be invoked to stop the component.

      It should not assume any other components are running when it is called.

      Returns Promise<void>