Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Adapter

An adapter for the underlying persistent file storage.

Rules for implementing an adapter:

  1. Throwing errors is unacceptable; log errors to the journal.
  2. Adapters must create paths recursively.
  3. Adapters must implement all required methods.
  4. Unsupported required methods must be a noop.

Hierarchy

  • Adapter

Index

Properties

flush

flush: () => Promise<void>

Flush the underlying file system to prepare for a commit.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

handle

handle: string

The handle for this adapter, basically an id. Should be something simple but descriptive, like 'node-fs' or 'blob'.

journal

journal: JournalEntry[]

Log useful messages to the journal about file operations.

link

link: (from: string, to: string, type: LinkType) => Promise<void>

Create a link in persistent storage.

Type declaration

    • (from: string, to: string, type: LinkType): Promise<void>
    • Parameters

      • from: string
      • to: string
      • type: LinkType

      Returns Promise<void>

mkdir

mkdir: (path: string) => Promise<void>

Make a directory or directory tree in persistent storage.

Type declaration

    • (path: string): Promise<void>
    • Parameters

      • path: string

      Returns Promise<void>

Optional read

read: (path: string) => Promise<Buffer>

Read a file from persistent storage.

Type declaration

    • (path: string): Promise<Buffer>
    • Parameters

      • path: string

      Returns Promise<Buffer>

remove

remove: (path: string, type: ItemType) => Promise<void>

Remove items from persistent storage.

Type declaration

    • (path: string, type: ItemType): Promise<void>
    • Parameters

      Returns Promise<void>

Readonly root

root: string

The real root of this file system which will be committed to.

snapshot

snapshot: () => AsyncGenerator<[string, SnapshotEntry], any, unknown>

Snapshot of the underlying file system; an asynchronous iterable which returns an entry of path and data.

Type declaration

write

write: (path: string, contents?: Buffer) => Promise<void>

Create a file or write the contents of a file to persistent storage.

Type declaration

    • (path: string, contents?: Buffer): Promise<void>
    • Parameters

      • path: string
      • Optional contents: Buffer

      Returns Promise<void>

Generated using TypeDoc