automata/fsevent/snapshot

Types

Immutable snapshot of one filesystem subtree at a single instant.

opaque because the only legitimate way to construct a snapshot is through entries that have already passed Entry’s validation. Snapshots are keyed on the canonical string rendering of each entry’s NormalizedPath so callers can lookup by either string or NormalizedPath without constructing a new opaque value.

pub opaque type Snapshot

Values

pub fn add_entry(
  snapshot snapshot: Snapshot,
  entry e: entry.Entry,
) -> Result(Snapshot, ast.FseventError)

Insert a single entry. Rejected if the path is already present.

pub fn empty_snapshot() -> Snapshot

A snapshot containing no entries.

pub fn entries(snapshot snapshot: Snapshot) -> List(entry.Entry)

All entries the snapshot holds, sorted by canonical path so that the order is deterministic across the BEAM and JavaScript targets.

pub fn from_entries(
  entries entries: List(entry.Entry),
) -> Result(Snapshot, ast.FseventError)

Build a snapshot from a list of entries. Two entries with the same path is rejected as DuplicatePath. Entries with the same file_id but different paths are allowed (POSIX hard links).

pub fn is_empty(snapshot snapshot: Snapshot) -> Bool

True when the snapshot has no entries.

pub fn lookup(
  snapshot snapshot: Snapshot,
  path path: path.NormalizedPath,
) -> option.Option(entry.Entry)

Look up the entry at path, if any.

pub fn snapshot_size(snapshot snapshot: Snapshot) -> Int

Number of entries in the snapshot.

Search Document