automata/fsevent
Types
pub type Entry =
entry.Entry
pub type EntryKind =
ast.EntryKind
pub type FseventError =
ast.FseventError
pub type NormalizedPath =
path.NormalizedPath
Pure-domain port of Go fsnotify semantics: Create, Write,
Remove, Rename, and Chmod operations derived from comparing
two filesystem Snapshot values. The library performs no I/O; the
caller produces snapshots by whatever means is appropriate (real
filesystem walk, mocked entries in tests, log replay) and feeds
pairs to diff/3.
This module is the user-facing facade. The submodules
(fsevent/{ast,path,op,entry,snapshot,watch,event,diff}) remain
available for callers who only need a slice of the API.
pub type Op =
ast.Op
pub type Snapshot =
snapshot.Snapshot
pub type Watch =
watch.Watch
pub type WatchEvent =
event.WatchEvent
Values
pub fn add_entry(
snapshot snapshot: snapshot.Snapshot,
entry entry: entry.Entry,
) -> Result(snapshot.Snapshot, ast.FseventError)
pub fn chmoded(
path path: path.NormalizedPath,
) -> event.WatchEvent
pub fn created(
path path: path.NormalizedPath,
) -> event.WatchEvent
pub fn diff(
prev prev: snapshot.Snapshot,
curr curr: snapshot.Snapshot,
watch watch: watch.Watch,
) -> List(event.WatchEvent)
Compute the events emitted when prev is replaced by curr under
the subscription described by watch.
pub fn empty_snapshot() -> snapshot.Snapshot
pub fn entry_directory(
path path: path.NormalizedPath,
mtime mtime: Int,
mode mode: Int,
file_id file_id: option.Option(String),
) -> Result(entry.Entry, ast.FseventError)
pub fn entry_file(
path path: path.NormalizedPath,
size size: Int,
mtime mtime: Int,
mode mode: Int,
content_hash content_hash: option.Option(String),
file_id file_id: option.Option(String),
) -> Result(entry.Entry, ast.FseventError)
Build a File entry. mtime is unit-less; the differ only checks
equality, so pick a unit (seconds, milliseconds, nanoseconds, …)
and use it consistently across snapshots.
pub fn entry_symlink(
path path: path.NormalizedPath,
mtime mtime: Int,
mode mode: Int,
file_id file_id: option.Option(String),
) -> Result(entry.Entry, ast.FseventError)
pub fn event_has(
event event: event.WatchEvent,
op op: ast.Op,
) -> Bool
pub fn event_ops(
event event: event.WatchEvent,
) -> set.Set(ast.Op)
pub fn event_path(
event event: event.WatchEvent,
) -> path.NormalizedPath
pub fn event_renamed_from(
event event: event.WatchEvent,
) -> option.Option(path.NormalizedPath)
pub fn from_entries(
entries entries: List(entry.Entry),
) -> Result(snapshot.Snapshot, ast.FseventError)
pub fn lookup(
snapshot snapshot: snapshot.Snapshot,
path path: path.NormalizedPath,
) -> option.Option(entry.Entry)
pub fn normalize(
path path: String,
) -> Result(path.NormalizedPath, ast.FseventError)
Canonicalise a string into a NormalizedPath.
pub fn path_is_absolute(path path: path.NormalizedPath) -> Bool
pub fn path_segments(
path path: path.NormalizedPath,
) -> List(String)
pub fn path_starts_with(
path path: path.NormalizedPath,
prefix prefix: path.NormalizedPath,
) -> Bool
pub fn path_to_string(path path: path.NormalizedPath) -> String
pub fn removed(
path path: path.NormalizedPath,
) -> event.WatchEvent
pub fn renamed(
to to: path.NormalizedPath,
from from: path.NormalizedPath,
) -> event.WatchEvent
pub fn snapshot_size(snapshot snapshot: snapshot.Snapshot) -> Int
pub fn unwatch_op(
watch watch: watch.Watch,
op op: ast.Op,
) -> watch.Watch
pub fn watch_all_ops() -> watch.Watch
pub fn watch_no_ops() -> watch.Watch
pub fn watch_op(
watch watch: watch.Watch,
op op: ast.Op,
) -> watch.Watch
pub fn with_ops(
watch watch: watch.Watch,
ops ops: set.Set(ast.Op),
) -> watch.Watch
pub fn written(
path path: path.NormalizedPath,
) -> event.WatchEvent