CereusDB API Documentation
    Preparing search index...

    Interface StorageBackend

    Storage backends for persistent databases (CREATE DATABASE 'opfs://mydb').

    A backend stores the files of persistent databases. Paths are relative to the backend root and use / as separator, for example mydb/manifest.json or mydb/segments/1.arrow.

    interface StorageBackend {
        list(path: string): Promise<string[]>;
        lock?(name: string): Promise<void>;
        readFile(path: string): Promise<Uint8Array<ArrayBuffer>>;
        remove(path: string): Promise<void>;
        unlock?(name: string): Promise<void>;
        writeFile(path: string, data: Uint8Array): Promise<void>;
    }

    Implemented by

    Index

    Methods

    • List entry names of a directory; directory names end with /. Missing directories list as empty.

      Parameters

      • path: string

      Returns Promise<string[]>

    • Acquire an exclusive lock (for example across browser tabs). Rejects if it is held elsewhere.

      Parameters

      • name: string

      Returns Promise<void>

    • Read a file. Resolves to null if it does not exist.

      Parameters

      • path: string

      Returns Promise<Uint8Array<ArrayBuffer>>

    • Remove a file or directory (recursively). Missing entries are ignored.

      Parameters

      • path: string

      Returns Promise<void>

    • Release a lock acquired with lock().

      Parameters

      • name: string

      Returns Promise<void>

    • Create or replace a file. Should replace the file atomically.

      Parameters

      • path: string
      • data: Uint8Array

      Returns Promise<void>