btrsync.sync.root.local

Btrfs roots implemented using locally executed btrfs commands.

Functions

LocalRoot(*[, sudo])

Return an appropriate btrfs root class for accessing local btrfs filesystems.

btrsync.sync.root.local.LocalRoot(*, sudo=False)[source]

Return an appropriate btrfs root class for accessing local btrfs filesystems.

Parameters

sudo – if True, use sudo to execute btrfs commands

Classes

LocalBtrfsRoot(rootpath, *[, scope, readonly])

Btrfs root implemented using local execution of btrfs commands, anchored at rootpath.

class btrsync.sync.root.local.LocalBtrfsRoot(rootpath, *, scope='all', readonly=True)[source]

Btrfs root implemented using local execution of btrfs commands, anchored at rootpath.

Parameters
  • rootpath – path to the target subvolume root

  • scope – determines the scope of accessible subvolumes: 'all' includes all subvolumes reachable from rootpath, 'strict' includes only subvolumes directly contained in rootpath, and 'isolated' behaves like 'strict', but also excludes other subvolumes from computing parentage

  • readonly – if True, list only readonly subvolumes

Raises

ValueError – for an invalid value of scope

async classmethod get_root(path, **kwargs)[source]

Determine the subvolume root containing path and return a btrfs root instance anchored there.

Parameters
  • path – the path to examine

  • kwargs – keyword arguments passed on to the btrfs root constructor

Returns

a tuple (root, relpath) containing the requested btrfs root instance along with the component of path relative to the root path

Raises

BtrfsError – if the operation fails

async classmethod is_root(path)[source]

Return whether path points to a btrfs subvolume root or not.

async list()[source]

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

async receive(fildes, path='.')[source]

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

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 (fildes, send_coro) containing the send stream and a coroutine that finalizes the send operation when run

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

Return detailed information about the subvolume pointed to by path.

static wrapcmds(cmds)[source]

Return cmds unchanged; override to customize executed commands.