gizfs:fs
POSIX metadata is one deterministic semantic client of the range journal. apply sees committed commands only. Immutable data uploads are not visible until this owner validates receipts and publishes an inode revision.
import * as Fs from "gizfs:fs";Types
Limits
type Limits = { inodes: i64; entries: i64; handles: i64; extents: i64; operations: i64; fileBytes: i64; logicalBytes: i64; sessions: i64; }The most of each kind a file system state holds: inodes, entries, handles, extents, operations, bytes and sessions.
inodes:i64entries:i64handles:i64extents:i64operations:i64fileBytes:i64logicalBytes:i64sessions:i64
Attribute
type Attribute = { name: string; value: bytes; }One extended attribute: its name and value.
name:stringvalue:bytes
Inode
type Inode = { id: i64; generation: i64; revision: i64; kind: string; parent: i64; uid: i64; gid: i64; mode: i64; links: i64; size: i64; accessed: i64; modified: i64; changed: i64; target: string; extents: Store.Spans; attributes: Vec<Attribute>; tier: i64; quota: i64; }Authoritative Unix nanoseconds; adapters must check conversions before submitting commands. tier: 0 when the extents hold the bytes of the file. Else the bytes are in the tier file of the file on its node (Store.tierName), as of tier version TIER (Op.tier), and the extents are the copy that the last seal left. quota: the quota root whose limit the bytes of a file count against (0: only the volume's): the directory that has the limit, which is its own root, and everything made in it (Quota).
id:i64generation:i64revision:i64kind:stringparent:i64uid:i64gid:i64mode:i64links:i64size:i64accessed:i64modified:i64changed:i64target:stringextents:_gizlang_lib_fs__store.Spansattributes:Vec<M61.Attribute>tier:i64quota:i64
Entry
type Entry = { parent: i64; name: string; inode: i64; }A directory entry: the parent directory, the name and the inode it names.
parent:i64name:stringinode:i64
Handle
type Handle = { id: i64; inode: i64; generation: i64; session: string; read: bool; write: bool; append: bool; }An open handle: its inode, generation, session and access modes.
id:i64inode:i64generation:i64session:stringread:boolwrite:boolappend:bool
Lock
type Lock = { inode: i64; session: string; owner: i64; profile: string; pid: i64; start: i64; end: i64; exclusive: bool; }A held byte-range lock of one owner of a session on an inode.
inode:i64session:stringowner:i64profile:stringpid:i64start:i64end:i64exclusive:bool
LockRequest
type LockRequest = { handle: i64; owner: i64; profile: string; start: i64; length: i64; exclusive: bool; pid: i64; }A request for a byte-range lock on an open handle.
handle:i64owner:i64profile:stringstart:i64length:i64exclusive:boolpid:i64
SetAttributes
type SetAttributes = { mode: Option<i64>; uid: Option<i64>; gid: Option<i64>; size: Option<i64>; accessed: Option<i64>; modified: Option<i64>; accessedNow: bool; modifiedNow: bool; }The attributes a setattr changes; an absent field stays.
mode:_gizlang_sdk_core.Option<i64>uid:_gizlang_sdk_core.Option<i64>gid:_gizlang_sdk_core.Option<i64>size:_gizlang_sdk_core.Option<i64>accessed:_gizlang_sdk_core.Option<i64>modified:_gizlang_sdk_core.Option<i64>accessedNow:boolmodifiedNow:bool
Outcome
type Outcome = { error: i64; value: i64; revision: i64; }The result of an operation: a negated errno or 0, its value and the revision it made.
error:i64value:i64revision:i64
Operation
type Operation = { session: string; id: string; digest: bytes; outcome: Outcome; lock: Option<LockRequest>; sequence: i64; terminalCut: i64; }id is the decimal text of sequence; the GFSS4 grammar encodes only sequence.
session:stringid:stringdigest:bytesoutcome:M61.Outcomelock:_gizlang_sdk_core.Option<M61.LockRequest>sequence:i64terminalCut:i64
SessionToken
type SessionToken = { history: string; incarnation: i64; session: string; }A session of a client: its history, incarnation and name.
history:stringincarnation:i64session:string
SessionOffer
type SessionOffer = { history: string; incarnation: i64; }The history and incarnation a new session takes.
history:stringincarnation:i64
Session
type Session = { token: SessionToken; uid: i64; gid: i64; phase: string; generation: i64; controlDigest: bytes; duration: i64; floor: i64; observed: i64; pruneAfter: bytes; pruneThrough: bytes; resumed: Option<SessionToken>; resumedHandles: Vec<i64>; abandon: bool; ceiling: i64; issuedDigest: bytes; resumeDigest: bytes; resumeGeneration: i64; }The state of a client session: its owner, phase, lease and resume data.
token:M61.SessionTokenuid:i64gid:i64phase:stringgeneration:i64controlDigest:bytesduration:i64floor:i64observed:i64pruneAfter:bytespruneThrough:bytesresumed:_gizlang_sdk_core.Option<M61.SessionToken>resumedHandles:Vec<i64>abandon:boolceiling:i64issuedDigest:bytesresumeDigest:bytesresumeGeneration:i64
Receipt
type Receipt = { outcome: Outcome; terminal: Option<Journal.Position>; fenced: bool; }The receipt of a command: its outcome, its journal position and whether a newer session fenced it.
outcome:M61.Outcometerminal:_gizlang_sdk_core.Option<gizlang_journal.Position>fenced:bool
HandleMapping
type HandleMapping = { source: i64; target: i64; }A handle of a resumed session (source) and its new number (target).
source:i64target:i64
Resume
type Resume = { token: SessionToken; handles: Vec<HandleMapping>; }A resumed session and the numbers of its handles.
token:M61.SessionTokenhandles:Vec<M61.HandleMapping>
SessionPage
type SessionPage = { rows: Vec<Session>; next: bytes; }One page of sessions and the key of the next page.
rows:Vec<M61.Session>next:bytes
SessionControl
type SessionControl = | { kind: "begin"; duration: i64; } | { kind: "renew"; expected: i64; acknowledgement: Journal.Acknowledgement; } | { kind: "acknowledge"; expected: i64; acknowledgement: Journal.Acknowledgement; } | { kind: "expire"; expected: i64; } | { kind: "prune"; expected: i64; } | { kind: "retire"; expected: i64; abandon: bool; } | { kind: "resume"; source: SessionToken; expected: i64; uid: i64; gid: i64; duration: i64; }A change of a session's lease: begin, renew, acknowledge, expire, prune, retire or resume.
beginrenewacknowledgeexpirepruneretireresume
RootDelta
type RootDelta = { inode: i64; revision: i64; roots: Store.Roots; edit: Option<ManifestEdit>; }Transient affected-root projection; revision zero removes an inode source.
inode:i64revision:i64roots:_gizlang_lib_fs__store.Rootsedit:_gizlang_sdk_core.Option<M61.ManifestEdit>
Work
type Work = { nodes: i64; slots: i64; examined: i64; }The work of the state's indexes: nodes, slots and the entries examined.
nodes:i64slots:i64examined:i64
ManifestEdit
type ManifestEdit = { before: Store.Spans; ranges: Vec<Store.ExtentRange>; delta: Option<Store.BlobDelta>; }Transient publication delta captured by the sole content mutation owner: the spans before the command, and the disjoint ranges it changed, each of whole spans before and after it. DELTA is the blobs of the spans the commands changed when each of them was a write (Store.Spans.edit): the root index applies it and walks no span.
before:_gizlang_lib_fs__store.Spansranges:Vec<_gizlang_lib_fs__store.ExtentRange>delta:_gizlang_sdk_core.Option<_gizlang_lib_fs__store.BlobDelta>
State
type State = { policy: Durability; limits: Limits; epoch: i64; next: i64; charged: i64; inodes: Catalog<Inode>; entries: Catalog<Entry>; handles: Catalog<Handle>; locks: Catalog<Lock>; operations: Catalog<Operation>; indexes: Ref<Indexes>; changed: Vec<i64>; removed: Vec<i64>; reap: Vec<i64>; wake: Vec<i64>; encoded: i64; beforeBytes: Map<i64, i64>; history: string; nextSession: i64; cut: i64; sessions: Catalog<Session>; ready: bool; pages: Option<Ref<NativePages>>; manifestEdits: Ref<Map<i64, ManifestEdit>>; quotas: Vec<Quota>; }The replicated state of a file system: its inodes, entries, handles, locks, sessions and their indexes.
policy:_gizlang_lib_fs__store.Durabilitylimits:M61.Limitsepoch:i64next:i64charged:i64inodes:_gizlang_lib_fs__catalog.Catalog<M61.Inode>entries:_gizlang_lib_fs__catalog.Catalog<M61.Entry>handles:_gizlang_lib_fs__catalog.Catalog<M61.Handle>locks:_gizlang_lib_fs__catalog.Catalog<M61.Lock>operations:_gizlang_lib_fs__catalog.Catalog<M61.Operation>indexes:Ref<M61.Indexes>changed:Vec<i64>removed:Vec<i64>reap:Vec<i64>wake:Vec<i64>encoded:i64beforeBytes:_gizlang_sdk_collections.Map<i64, i64>history:stringnextSession:i64cut:i64sessions:_gizlang_lib_fs__catalog.Catalog<M61.Session>ready:boolpages:_gizlang_sdk_core.Option<Ref<M60.NativePages>>manifestEdits:Ref<_gizlang_sdk_collections.Map<i64, M61.ManifestEdit>>quotas:Vec<M61.Quota>
Quota
type Quota = { root: i64; limit: i64; charged: i64; }The limit of the file bytes under directory ROOT, and the bytes that count against it: those of each file whose quota is ROOT (Inode.quota). The volume is root 0: its record is limits.logicalBytes and charged. A write grows a file when both its root and the volume have room (room: EDQUOT, then ENOSPC). The administrator, or the owner of the namespace root, gives a limit with the xattr QUOTA_ATTRIBUTE (changeQuota): to an empty directory under no other root, which becomes a root, or a new limit to a root. A rename or a link to a directory of another root is EXDEV.
root:i64limit:i64charged:i64
StorePiece
type StorePiece = { offset: i64; length: i64; }One piece of a stored write: LENGTH bytes at OFFSET of the file, the next LENGTH bytes of its data. A flush sends the small writes it holds as the pieces of one stored write: one command and one blob, not one for each write.
offset:i64length:i64
Op
type Op = | { kind: "create"; parent: i64; name: string; of: string; mode: i64; target: string; } | { kind: "open"; inode: i64; read: bool; write: bool; append: bool; } | { kind: "close"; handle: i64; } | { kind: "write"; handle: i64; offset: i64; blob: Store.Identity; proof: Vec<Store.Receipt>; } | { kind: "store"; handle: i64; pieces: Vec<StorePiece>; data: bytes; blob: Option<Store.Identity>; } | { kind: "truncate"; handle: i64; size: i64; } | { kind: "punch"; handle: i64; offset: i64; length: i64; } | { kind: "link"; inode: i64; parent: i64; name: string; } | { kind: "unlink"; parent: i64; name: string; directory: bool; } | { kind: "rename"; parent: i64; name: string; targetParent: i64; targetName: string; flags: i64; } | { kind: "chmod"; inode: i64; mode: i64; } | { kind: "chown"; inode: i64; uid: i64; gid: i64; } | { kind: "xattr"; inode: i64; name: string; value: bytes; remove: bool; } | { kind: "lock"; handle: i64; owner: i64; start: i64; length: i64; exclusive: bool; release: bool; } | { kind: "endSession"; session: string; } | { kind: "clone"; inode: i64; parent: i64; name: string; } | { kind: "copyFile"; source: i64; target: i64; } | { kind: "openFile"; inode: i64; read: bool; write: bool; append: bool; truncate: bool; } | { kind: "createOpen"; parent: i64; name: string; mode: i64; read: bool; write: bool; append: bool; exclusive: bool; truncate: bool; } | { kind: "setattr"; inode: i64; handle: i64; changes: SetAttributes; } | { kind: "setxattr"; inode: i64; name: string; value: bytes; flags: i64; } | { kind: "lockOwned"; handle: i64; owner: i64; profile: string; start: i64; length: i64; exclusive: bool; release: bool; pid: i64; } | { kind: "closeOwned"; handle: i64; owner: i64; } | { kind: "releaseLocks"; handle: i64; owner: i64; profile: string; } | { kind: "endOwner"; owner: i64; } | { kind: "access"; handle: i64; } | { kind: "lockWait"; request: LockRequest; } | { kind: "cancelLock"; request: i64; } | { kind: "reserve"; count: i64; } | { kind: "make"; id: i64; parent: i64; name: string; of: string; mode: i64; target: string; } | { kind: "delegate"; inode: i64; release: bool; } | { kind: "tier"; inode: i64; version: i64; size: i64; } | { kind: "band"; band: i64; } | { kind: "junction"; parent: i64; name: string; id: i64; phase: i64; } | { kind: "moving"; release: bool; } | { kind: "batch"; ops: Vec<Op>; } | { kind: "session"; control: SessionControl; }A file system operation of a command.
createopenclosewritestoretruncatepunchlinkunlinkrenamechmodchownxattrlockendSessionclonecopyFileopenFilecreateOpensetattrsetxattrlockOwnedcloseOwnedreleaseLocksendOwneraccesslockWaitcancelLockreservemakedelegatetierbandjunctionmovingbatchsession
Command
type Command = { sequence: i64; session: string; epoch: i64; uid: i64; gid: i64; now: i64; op: Op; history: string; incarnation: i64; }now is authenticated execution time in Unix nanoseconds, not a client-supplied clock.
sequence:i64session:stringepoch:i64uid:i64gid:i64now:i64op:M61.Ophistory:stringincarnation:i64
Listing
type Listing = { revision: i64; entries: Vec<Entry>; inodes: Vec<Inode>; next: string; }inodes[i] is the inode of entries[i]: a mount shows a listing with its attributes and asks for none of them.
revision:i64entries:Vec<M61.Entry>inodes:Vec<M61.Inode>next:string
Functions
bandOf
function bandOf(id: i64): i64The band of an inode or handle number (BAND_BITS).
Effects: fail.
band
function band(state: State): i64The band of the range of STATE. Its next number never leaves its band (idsLeft).
Effects: fail.
remoteInode
function remoteInode(id: i64): InodeWhat a lookup or a listing shows for file or directory ID of another range: no attributes; the client reads them there.
Effects: fail, write.
limits
function limits(): LimitsThe default Limits.
nativeLimits
function nativeLimits(): LimitsNative rows/extents are disk bounded; per-session handles remain admitted.
kindValid
function kindValid(kind: string): boolThe kinds of inode: a file, a directory, a symbolic link, and the two nodes whose use is the kernel's (a unix-domain socket and a named pipe): no bytes, no device number, no user extended attributes.
attributes
function attributes(): SetAttributesA SetAttributes that changes nothing.
quotaOf
function quotaOf(state: State, id: i64): QuotaThe limit and the charged bytes of the quota root of inode ID: its own when it is a root, else that of the directory it is in (0 the volume's). What a mount answers statfs with in that directory (Volume CAPACITY).
Effects: fail, read, write, console, io.
storeOp
function storeOp(handle: i64, offset: i64, data: bytes): OpA stored write of DATA at OFFSET (one piece).
Effects: fail.
storedLimit
function storedLimit(policy: Durability): i64The largest stored write of a range: a whole chunk (Store.MAX_CHUNK) on one node, else STORED_WRITE_BYTES. On one node a write of up to 1 MiB is one commit: one log sync after one syncfs of its blob (Volume.logged), which a group commit shares. With more nodes a larger write goes from the client to each owner at once (Client.place) and the log commits only its identity and receipts: the leader reads, copies and relays no data bytes.
batchable
function batchable(op: Op): boolThe ops a batch holds: the changes a mount answers before their commit (fuse.giz Back), none with a handle, a lock or a session, and stored writes that stay in the entry.
storesBytes
function storesBytes(op: Op): boolTrue when OP, or an op of its batch, is a stored write.
Effects: fail.
newState
function newState(policy: Durability, bounds: Limits, uid: i64, gid: i64, history: string): State throws stringA new, empty state with the root directory owned by UID and GID.
Effects: fail, read, write, console, io.
inodeOfHandle
function inodeOfHandle(state: State, handle: i64): i64The inode of the open HANDLE, or -1.
Effects: fail, read, write, console, io.
historyValid
function historyValid(history: string): boolWhether HISTORY is a valid history name.
Effects: fail.
sameToken
function sameToken(a: SessionToken, b: SessionToken): boolWhether A and B name the same session incarnation.
offerSession
function offerSession(state: State): SessionOffer throws i64The history and incarnation a new session of STATE takes.
Effects: fail.
requestCeiling
function requestCeiling(state: State, token: SessionToken): i64 throws i64The highest command sequence the session TOKEN may send.
Effects: fail, read, write, console, io.
sessionPage
function sessionPage(state: State, after: bytes, count: i64, budget: i64, uid: i64): SessionPage throws i64Administrator selection exposes historical recovery authority, never a live handle grant. Canonical rows and their byte grammar stay at this owner.
Effects: fail, read, write, console, io.
sessionStatus
function sessionStatus(state: State, token: SessionToken, uid: i64, gid: i64): Session throws i64The session TOKEN as UID and GID may see it.
Effects: fail, read, write, console, io.
authorize
function authorize(state: State, token: SessionToken, uid: i64, gid: i64): bool throws i64Read-only selectors and cached directory adapters use this same owner check.
Effects: fail, read, write, console, io.
resumedSession
function resumedSession(state: State, source: SessionToken, uid: i64): Resume throws i64Mapping is an immutable recovery receipt; closing a resumed handle does not erase which open description the administrator resumed.
Effects: fail, read, write, console, io.
pendingCount
function pendingCount(state: State): i64The lock requests that wait.
Effects: fail, read.
work
function work(state: State): WorkThe work of the state's indexes.
Effects: fail, read.
xattrNameValid
function xattrNameValid(name: string): boolWhether NAME is a valid extended attribute name.
Effects: fail.
blockedBy
function blockedBy(state: State, command: Command): Vec<i64>The delegated directories that refuse COMMAND: another session holds the names that it changes. And the files whose bytes it changes, which another session holds, or which are in a tier file that the session does not hold.
Effects: fail, read, write, console, io.
tiered
function tiered(state: State, limit: i64): Vec<i64>The files whose bytes are in tier files (Inode.tier), up to LIMIT: a backup or a second node takes the extents.
Effects: fail, read, write, console, io.
delegatedElsewhere
function delegatedElsewhere(state: State, id: i64, session: string): boolAnother session than SESSION holds the names of directory ID (Op.delegate).
Effects: fail, read, write, console, io.
madeInode
function madeInode(id: i64, dir: Inode, kind: string, uid: i64, gid: i64, mode: i64, target: string, now: i64): InodeThe inode that a create of KIND in directory DIR makes: a set-group-ID directory gives its group, and its bit to a directory. A mount that answers a create itself shows the same (fuse.giz, Adapter.make).
Effects: fail, write.
requestDigest
function requestDigest(tenant: string, command: Command): bytesThe digest an operation record keeps of its command. A stored write is digested with the identity of its bytes in their place, so its bytes are hashed once (Volume.resolveStored) for the digest, the extent and the kept blob.
Effects: fail.
advanceCut
function advanceCut(state: mut State, position: Journal.Position): bool throws i64Volume forwards every committed range index, including non-FS entries, so acknowledged cuts refer to the common journal rather than FS-only traffic.
Effects: fail.
commitHistory
function commitHistory(state: mut State, history: string, position: Journal.Position): bool throws i64The first range identity is itself a committed consensus decision.
Effects: fail.
replay
function replay(state: State, command: Command): Result<Option<Outcome>, i64>The outcome of COMMAND when it was applied already, none when it is new, or ESTALE when it is not valid.
Effects: fail, read, write, console, io.
apply
function apply(state: mut State, command: Command, position: Journal.Position): OutcomeApplies COMMAND at POSITION and returns its outcome.
Effects: fail, read, write, console, io.
stat
function stat(state: State, id: i64): Inode throws i64The inode ID.
Effects: fail, read, write, console, io.
lookup
function lookup(state: State, parent: i64, name: string, uid: i64, gid: i64): Inode throws i64The inode that NAME in directory PARENT names, as UID and GID may see it.
Effects: fail, read, write, console, io.
list
function list(state: State, parent: i64, revision: i64, after: string, count: i64, uid: i64, gid: i64): Listing throws i64Resumable lexical cookies are revision-bound; mutation requires a restart.
Effects: fail, read, write, console, io.
read
function read(state: State, token: SessionToken, handle: i64, offset: i64, count: i64, fetch: (blob: Store.Identity) => Result<bytes, string>): Result<bytes, i64>COUNT bytes at OFFSET of the open HANDLE.
Effects: fail, read, write, console, io.
readRange
function readRange(state: State, token: SessionToken, handle: i64, offset: i64, count: i64, read: (blob: Store.Identity, start: i64, count: i64) => Result<bytes, string>): bytes throws i64COUNT bytes at OFFSET of the open HANDLE, with stored pieces read by READ.
Effects: fail, read, write, console, io.
readableHandle
function readableHandle(state: State, token: SessionToken, handle: i64): Inode throws i64The file that HANDLE of the session reads.
Effects: fail, read, write, console, io.
readInode
function readInode(state: State, token: SessionToken, id: i64, offset: i64, count: i64, uid: i64, gid: i64, read: (blob: Store.Identity, start: i64, count: i64) => Result<bytes, string>): bytes throws i64Reads the file ID for a session that holds no handle of it: a mount's read-only open (no commit to open or close it). The session must be active, and its principal must be allowed to read the file now, as openFile checks. Inode ids are never used again, so a removed file is ENOENT.
Effects: fail, read, write, console, io.
readableInode
function readableInode(state: State, token: SessionToken, id: i64, uid: i64, gid: i64): Inode throws i64The file ID, which the session's principal UID GID may read (readInode).
Effects: fail, read, write, console, io.
readPieces
function readPieces(state: State, inode: Inode, offset: i64, count: i64): Vec<Store.RangePiece> throws i64The pieces of a read of COUNT bytes at OFFSET of INODE, up to its size (Store.readPiece reads each).
Effects: fail, read, write, console, io.
accessStale
function accessStale(inode: Inode, now: i64): boolWhether the access time of INODE is to be updated (relatime).
Effects: fail.
openedInode
function openedInode(state: State, token: SessionToken, handle: i64): Inode throws i64The inode of the open HANDLE of the session TOKEN.
Effects: fail, read, write, console, io.
changedInode
function changedInode(state: State, token: SessionToken, op: Op, outcome: Outcome): Option<Inode>The inode a successful OP made or changed, for its reply: a mount answers CREATE, MKNOD, MKDIR, SYMLINK, LINK and SETATTR with it and asks for no stat. TOKEN is the session that holds the handles OP names.
Effects: fail, read, write, console, io.
writeAdmission
function writeAdmission(state: State, token: SessionToken, handle: i64): bool throws i64Whether the open HANDLE of the session TOKEN may write now.
Effects: fail, read, write, console, io.
getxattr
function getxattr(state: State, id: i64, name: string, uid: i64, gid: i64): bytes throws i64The value of the extended attribute NAME of inode ID.
Effects: fail, read, write, console, io.
listxattr
function listxattr(state: State, id: i64, uid: i64, gid: i64): Vec<string> throws i64The extended attribute names of inode ID.
Effects: fail, read, write, console, io.
getlock
function getlock(state: State, token: SessionToken, handle: i64, owner: i64, profile: string, start: i64, length: i64, exclusive: bool): Result<Option<Lock>, i64>The lock that conflicts with a request on HANDLE, if any (fcntl F_GETLK).
Effects: fail, read, write, console, io.
receipt
function receipt(state: State, token: SessionToken, sequence: i64, uid: i64, gid: i64): Receipt throws i64The receipt of command SEQUENCE of the session TOKEN.
Effects: fail, read, write, console, io.
commandReceipt
function commandReceipt(state: State, command: Command): Receipt throws i64A mutation response may reuse a retained receipt only for that exact payload. Status-by-sequence remains a separate query and cannot certify a changed retry.
Effects: fail, read, write, console, io.
lockStatus
function lockStatus(state: State, token: SessionToken, sequence: i64, uid: i64, gid: i64): Receipt throws i64Resolves the original lock request. A canceled or granted terminal outcome never changes on retry, and reading status never adds operation records.
Effects: fail, read, write, console, io.
roots
function roots(state: State): Vec<Store.Identity>Live namespace roots include unlinked open files until the final close.
Effects: fail, read, write, console, io.
rootDelta
function rootDelta(state: State): Vec<RootDelta>Hot publication consumes only IDs emitted by canonical mutation points. Restore uses roots/full catalog rebuilding; this transient projection never scans unrelated inode extents or participates in a snapshot encoding.
Effects: fail, read, write, console, io.
formats
function formats(): Vec<Format>The on-disk formats this module reads and writes.
Effects: fail.
encodeCommand
function encodeCommand(command: Command): bytesThe bytes of COMMAND.
Effects: fail.
writeCommand
function writeCommand(out: mut bytes, command: Command): voidAppends the encoding of COMMAND to OUT: a log entry writes its tag and the command into one buffer, so a stored write's bytes are copied once, not into the command and then into the entry.
Effects: fail.
decodeCommand
function decodeCommand(data: bytes): Command throws stringThe command DATA holds.
Effects: fail, read, write, console, io.
writeToken
function writeToken(out: mut bytes, token: SessionToken): voidWrites TOKEN to OUT.
Effects: fail.
writeInode
function writeInode(out: mut bytes, inode: Inode): voidWrites INODE to OUT.
Effects: fail, read.
encodeState
function encodeState(state: State): bytesThe bytes of STATE (a snapshot).
Effects: fail, read, write, console, io.
nativeImage
function nativeImage(data: bytes): boolWhether DATA is a snapshot of a native state.
Effects: fail.
nativePageBytes
function nativePageBytes(data: bytes): i64 throws stringThe page bytes of the native snapshot DATA.
Effects: fail, read, write, console, io.
writeSession
function writeSession(out: mut bytes, session: Session): voidWrites SESSION to OUT.
Effects: fail.
writeFsReceipt
function writeFsReceipt(out: mut bytes, receipt: Receipt): voidWrites RECEIPT to OUT.
Effects: fail.
encodedSize
function encodedSize(state: State): i64The bytes of the snapshot of STATE. A native state counts the roots of its pages as they are: they encode in as many bytes as the roots of a snapshot, which write the pending changes of each command (nativeStateBytes).
Effects: fail, read, write, console, io.
decodeState
function decodeState(data: bytes, policy: Durability, bounds: Limits): State throws stringThe state the snapshot DATA holds.
Effects: fail, read, write, console, io.
branchState
function branchState(source: State, history: string, uid: i64): State throws stringExplicit writable branch: retain source open descriptions and historical outcomes, remove stale lock authority, and require fresh issued resume tokens. Ordinary snapshot installation never calls this operation.
Effects: fail, read, write, console, io.
validateState
function validateState(state: State): bool throws stringA digest is insufficient if a snapshot encodes impossible references.
Effects: fail, read, write, console, io.
newNativeState
function newNativeState(policy: Durability, bounds: Limits, uid: i64, gid: i64, history: string, owner: Ref<NativePages>): State throws stringA new, empty state whose tables are pages that OWNER keeps.
Effects: fail, read, write, console, io.
pageState
function pageState(source: State, owner: Ref<NativePages>): State throws stringThe state of SOURCE in the pages of OWNER: one explicit migration of a bounded old snapshot, or a page compaction of a native state (Volume.compactPages), which copies only what its rows reach. All derived indexes are rebuilt from their semantic owners; old slot addresses are never imported. A native state goes into pages of another owner, with no delta of a commit; extents in the inode row stay there (placedExtents).
Effects: fail, read, write, console, io.
encodeNativeState
function encodeNativeState(state: State): bytes throws stringThe bytes of the native STATE (a snapshot).
Effects: fail, read, write, console, io.
nativeFiles
function nativeFiles(state: State): NativeFiles throws stringThe files of the native STATE.
Effects: fail, read, write, console, io.
decodeNativeState
function decodeNativeState(data: bytes, policy: Durability, bounds: Limits, owner: Ref<NativePages>): State throws stringThe native state the snapshot DATA holds, its pages kept by OWNER.
Effects: fail, read, write, console, io.
Methods
Reader.sessionToken
function Reader.sessionToken(self: mut Reader): SessionTokenReads a SessionToken.
Effects: fail, read, write, console, io.
Reader.inode
function Reader.inode(self: mut Reader): InodeReads an Inode.
Effects: fail, read, write, console, io.
Reader.inodeWithPages
function Reader.inodeWithPages(self: mut Reader, owner: Option<Ref<NativePages>>): InodeReads an Inode whose pages OWNER keeps, if any.
Effects: fail, read, write, console, io.
Reader.session
function Reader.session(self: mut Reader, bounds: Limits): SessionReads a Session within BOUNDS.
Effects: fail, read, write, console, io.
Reader.fsReceipt
function Reader.fsReceipt(self: mut Reader): ReceiptReads a Receipt.
Effects: fail, read, write, console, io.
Constants
EPERM
const EPERM = -1The errno EPERM, negated: the operation is not permitted.
ENOENT
const ENOENT = -2The errno ENOENT, negated: no such file or directory.
EINTR
const EINTR = -4The errno EINTR, negated: the call was interrupted.
EIO
const EIO = -5The errno EIO, negated: an input or output error.
EBADF
const EBADF = -9The errno EBADF, negated: the handle is not open.
EAGAIN
const EAGAIN = -11The errno EAGAIN, negated: try again (a lock is held).
EACCES
const EACCES = -13The errno EACCES, negated: permission denied.
EEXIST
const EEXIST = -17The errno EEXIST, negated: the name exists.
ENOTDIR
const ENOTDIR = -20The errno ENOTDIR, negated: not a directory.
EISDIR
const EISDIR = -21The errno EISDIR, negated: a directory.
EINVAL
const EINVAL = -22The errno EINVAL, negated: an invalid argument.
ENOSPC
const ENOSPC = -28The errno ENOSPC, negated: no space left (a limit of Limits).
EDEADLK
const EDEADLK = -35The errno EDEADLK, negated: a lock wait would deadlock.
ENODATA
const ENODATA = -61The errno ENODATA, negated: no such extended attribute.
ENOTEMPTY
const ENOTEMPTY = -39The errno ENOTEMPTY, negated: the directory is not empty.
ELOOP
const ELOOP = -40The errno ELOOP, negated: too many symbolic links.
EINPROGRESS
const EINPROGRESS = -115The errno EINPROGRESS, negated: the operation is still in progress.
ENOTSUP
const ENOTSUP = -95The errno ENOTSUP, negated: the operation is not supported.
ESTALE
const ESTALE = -116The errno ESTALE, negated: the session or handle is stale.
EBUSY
const EBUSY = -16The errno EBUSY, negated: the resource is busy.
EXDEV
const EXDEV = -18The errno EXDEV, negated: the rename crosses ranges.
EDQUOT
const EDQUOT = -122A quota root's limit refuses the bytes (Quota).
RENAME_NOREPLACE
const RENAME_NOREPLACE = 1The flag of Op.rename that refuses to replace a name at the target (renameat2 RENAME_NOREPLACE).
BAND_BITS
const BAND_BITS = 40The inode and handle numbers of a range are a band: BAND << BAND_BITS on (Ranges). Band 0 holds the namespace root. A file or directory that a directory of another range names (Op.junction) has an anchor here instead of a name.
MAX_BAND
const MAX_BAND = 4194304The bands: band << BAND_BITS stays far under the largest i64.
ANCHOR
const ANCHOR = 0The parent of the anchors: the entry string(ID) under ANCHOR keeps file or directory ID while a directory of another range names it, and the inode has that directory as its parent. No inode has this number, so no path shows an anchor.
REMOTE
const REMOTE = "remote"The of of an inode whose content is in another range.
PRUNE_BATCH
const PRUNE_BATCH = 64The most journal entries one prune removes.
QUOTA_ATTRIBUTE
const QUOTA_ATTRIBUTE = "user.gizfs.quota"The xattr that gives a directory a quota (changeXattr): the limit in bytes, in decimal.
MAX_QUOTAS
const MAX_QUOTAS = 65536The quota records a range keeps at most: one for each Drive.
STORED_WRITE_BYTES
const STORED_WRITE_BYTES = 65536The largest write whose bytes ride in its own command. Each voter writes them once, as an immutable blob, before the log entry that names them by identity (Volume.logged); the blob is synced before that entry (Raft ordered).
MAX_STORE_PIECES
const MAX_STORE_PIECES = 1024The most pieces of one stored file.
MAX_BATCH_OPS
const MAX_BATCH_OPS = 64Most ops of one batch: its log entry stays far under MAX_COMMAND_BYTES.
INLINE_STORE_BYTES
const INLINE_STORE_BYTES = 65536A stored write of fewer bytes stays in its log entry; a larger one goes to its blob and the entry names it (Volume.logged).