Skip to main content

Module fs

Module fs 

Source
Expand description

Filesystem CertStorage.

Layout under dir: account.json, certs/<cert_id>/{chain.pem,key.pem,meta.json}, challenges/<domain> ({key_auth, expires_at}), leases/<cert_id> ({owner, expires_at}). Every write is temp-file + rename; secret files are 0600 on unix. Expired challenge/lease files read as absent.

StructsΒ§

ChallengeFile πŸ”’
FsCertStorage
LeaseFile πŸ”’
MetaFile πŸ”’
TakeoverGuard πŸ”’
RAII holder of the exclusive <lease>.takeover marker; removes it on drop.

ConstantsΒ§

TAKEOVER_MARKER_STALE_SECS πŸ”’
How long a <lease>.takeover marker may exist before it is assumed to belong to a process that died mid-takeover. The marker is held for a couple of filesystem operations, so anything older than this is debris.

StaticsΒ§

LEASE_TMP_COUNTER πŸ”’
Per-process, monotonically increasing disambiguator folded into lease temp file names, so two calls in the same process racing in the same nanosecond still can’t collide on the temp path.

FunctionsΒ§

atomic_write πŸ”’
Writes bytes to path atomically (temp file beside it, then rename). secret files get 0600 on unix before the rename.
create_marker πŸ”’
Exclusive create; the content is only ever read by a human debugging.
expires_at πŸ”’
io_err πŸ”’
lease_tmp_path πŸ”’
A temp path beside lease_path that is unique to this call: no two concurrent callers (same process or different) land on the same name, so each writes its own temp file undisturbed before attempting to publish it.
read_opt πŸ”’
remove_opt πŸ”’