Documentation
¶
Overview ¶
Package durable writes the files a later start of funcd trusts, so a power loss leaves the old content or the new one, never an empty or a partial file (#1244): every file and directory is synced before the step that makes it visible, and the directory that holds a renamed or created entry is synced after it.
Index ¶
- type Disk
- func (d Disk) Link(oldpath, newpath string) error
- func (d Disk) MkdirAll(dir string, perm fs.FileMode) error
- func (d Disk) Rename(oldpath, newpath string) error
- func (d Disk) SyncDir(dir string) error
- func (d Disk) SyncFile(f *os.File) error
- func (d Disk) SyncTree(root string) error
- func (d Disk) WriteFile(dir, name string, data []byte, perm fs.FileMode) error
- type Op
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Disk ¶
Disk does durable writes. Its zero value acts on the file system; Trace, when set, gets each step once it is done, so a test can check their order.
func (Disk) Link ¶
Link makes newpath a second name of oldpath, failing when newpath exists; the caller syncs newpath's directory before it relies on the link.
func (Disk) MkdirAll ¶
MkdirAll makes dir and its missing parents at mode perm, then syncs the parent of each directory it made, outermost first.
func (Disk) Rename ¶
Rename moves oldpath to newpath; the caller syncs newpath's directory before it relies on the move.
func (Disk) SyncDir ¶
SyncDir syncs dir, so the entries created, renamed or removed in it survive a power loss.