annals.target#
The transport seam: a document tree lands in a directory, here or on another machine.
A Target is the handful of filesystem verbs the store needs (put a directory, move,
remove, read and write a text file, list sub-directories, read every meta.json under a
directory). Two implementations:
LocalTarget: a directory on this machine, plainpathlib/shutil.SshTarget:host:pathon another machine, through the systemsshandrsyncin batch mode (no prompts, so an agent never hangs). The host is whatever the user’s~/.ssh/configresolves, so an alias such astwworks.
parse_target() picks one from a string. An HTTP target (a bearer-token ingest
endpoint) is the declared replacement for the ssh one and is not built yet.
Module Attributes
Separator between concatenated meta.json files when reading many at once over ssh. |
Functions
|
Refuse anything that could escape the root; the store only ever passes safe paths. |
|
|
Classes
|
A directory on this machine. |
|
|
|
What the store needs from wherever the documents live. |
- annals.target.RECORD_SEP = '\x1e'#
Separator between concatenated meta.json files when reading many at once over ssh.
- class annals.target.SshTarget(host, root)[source]#
Bases:
objecthost:pathon another machine, via the system ssh and rsync in batch mode.
- class annals.target.Target(*args, **kwargs)[source]#
Bases:
ProtocolWhat the store needs from wherever the documents live.
- annals.target.check_rel(rel)[source]#
Refuse anything that could escape the root; the store only ever passes safe paths.
- Return type:
- annals.target.parse_target(spec)[source]#
host:/pathbecomes anSshTarget; anything else aLocalTarget.- Return type: