btrsync.sync.root.file

Btrfs roots implemented using local file I/O.

Functions

DumpRoot(*[, sudo])

Return an appropriate btrfs root class for dumping to a local file.

FileRoot(*[, sudo])

Return an appropriate btrfs root class sourced from file I/O.

btrsync.sync.root.file.DumpRoot(*, sudo=None)[source]

Return an appropriate btrfs root class for dumping to a local file.

btrsync.sync.root.file.FileRoot(*, sudo=None)[source]

Return an appropriate btrfs root class sourced from file I/O.

Classes

FileRecvRoot(rootpath, *[, subroot, ...])

Btrfs root that saves the send stream to a local file in receive().

FileSendRoot(rootpath)

Read-only btrfs root implemented using local file I/O.

class btrsync.sync.root.file.FileRecvRoot(rootpath, *, subroot=None, create_recvpath=False, namer=None, dump_pipe=[], ext='')[source]

Btrfs root that saves the send stream to a local file in receive().

Calling send() will raise NotImplementedError. Other methods are delegated to subroot, if supplied, or return no-op defaults.

Parameters
  • rootpath – directory to save the send streams into; if None will not save any files and dump_pipe must be supplied

  • subroot – if supplied, delegate list() and show() to this root

  • create_recvpath – if True, ensure the path passed to receive() exists

  • namer – function that takes the send stream metadata and returns a file name, if None use default

  • dump_pipe – a sequence of commands to run in a pipeline and pass the send stream through before saving

  • ext – extension to append to saved file names

async classmethod get_root(path, **kwargs)

No-op; call constructor with path.

async classmethod is_root(path)

No-op; return True.

async list(*args, **kwargs)[source]

List available subvolumes within this root, as a sequence of COW hierarchy roots.

property name

Human-readable name identifying this root and the location it refers to.

async receive(flow, path='.', *, meta={})[source]

Perform a receive operation into path using the send stream provided by flow.

Parameters
  • flow – a btrsync.util.Flow containing the btrfs send stream

  • path – the relative path to receive into

  • meta – (optional) additional metadata about the send stream

Returns

a coroutine that finalizes the receive operation when run

async send(*args, **kwargs)[source]

Not implemented; raises NotImplementedError.

async show(*args, **kwargs)[source]

Return detailed information about the subvolume pointed to by path.

static wrapcmds(cmds)

Return cmds unchanged; override to customize executed commands.

class btrsync.sync.root.file.FileSendRoot(rootpath)[source]

Read-only btrfs root implemented using local file I/O.

Calling receive() will raise NotImplementedError.

Parameters

rootpath – path to the target input file

async classmethod get_root(path, **kwargs)

No-op; call constructor with path.

async classmethod is_root(path)

No-op; return True.

async list()[source]

No-op; return a single volume with path rootpath and a random uuid.

property name

Human-readable name identifying this root and the location it refers to.

async receive(flow, path='.', *, meta={})[source]

Not implemented; raises NotImplementedError.

async send(*paths, parent=None, clones=[])[source]

Set up a send operation of paths with parent parent and clones clones.

Parameters
  • paths – the paths of the subvolumes to send

  • parent – if not None, the path of the parent subvolume to use for incremental send

  • clones – sequence of paths of clone subvolumes

Returns

a tuple (flow, send_coro) containing the send btrsync.util.Flow and a coroutine that finalizes the send operation when run

async show(path='.')[source]

No-op; return rootpath and empty properties.