Expand description
The barkd single-instance guarantee: barkd.lock, exclusively locked
for the process lifetime. The wallet’s LOCK can’t serve here, since
it is only taken once a wallet is open.
Constants§
- BARKD_
LOCK_ FILE - File in the datadir exclusively locked for the lifetime of a barkd process.
- BARKD_
URL_ FILE - File in the datadir carrying the base URL the barkd holding the lock listens on. Only meaningful while the lock is held.
Functions§
- acquire_
barkd_ lock - Take the exclusive barkd lock on the datadir, or fail fast when another barkd already runs there. The OS releases the lock when the returned value is dropped or the process exits, even on SIGKILL or a crash.
- barkd_
pid - The pid of the barkd holding the datadir lock, or
Nonewhen no barkd is running there. The flock, not the file’s existence, is the liveness signal: the OS releases it the instant the holder dies. - barkd_
url - The base URL recorded by the barkd on this datadir, if any.
- store_
barkd_ url - Record the base URL this barkd listens on, so that clients on the same datadir connect to it instead of the default listen address.
- wipe_
datadir_ except_ barkd_ files - Remove everything in the datadir except the running barkd’s own files, so the held lock, auth token and listen URL survive a wallet wipe.