btrsync.btrfs¶
Data structures and functions manipulating btrfs subvolumes.
Module Attributes
Path of the btrfs filesystem root, as printed by |
- btrsync.btrfs.FSTREE = '<FS_TREE>'¶
Path of the btrfs filesystem root, as printed by
btrfs-progs.
Functions
|
Process a sequence of btrfs volumes, making all relative paths absolute; absolute paths are left unchanged. |
|
Process a sequence of btrfs volumes, making all paths below a chosen root relative to that root; other paths are left unchanged. |
- btrsync.btrfs.abspaths(vols, rootpath)[source]¶
Process a sequence of btrfs volumes, making all relative paths absolute; absolute paths are left unchanged.
- Parameters
vols – the sequence of btrfs subvolumes to process
rootpath – the absolute path that subvolume paths are relative to
- Returns
iterator over the modified subvolumes
- Raises
ValueError – if rootpath is not absolute (does not start with
FSTREE)
- btrsync.btrfs.relpaths(vols, rootpath)[source]¶
Process a sequence of btrfs volumes, making all paths below a chosen root relative to that root; other paths are left unchanged.
- Parameters
vols – the sequence of btrfs subvolumes to process
rootpath – the absolute path that subvolume paths are to be made relative to
- Returns
iterator over the modified subvolumes
- Raises
ValueError – if rootpath is not absolute (does not start with
FSTREE)
Classes
|
Build a hierarchy of btrfs subvolumes based on snapshotting (COW) parentage. |
- class btrsync.btrfs.COWTree(subvols, check=None)[source]¶
Build a hierarchy of btrfs subvolumes based on snapshotting (COW) parentage.
- Parameters
subvols – the sequence of subvolumes (
dictinstances keyed by subvolume properties) to processcheck – a function that takes a subvolume as argument and returns a boolean whether to consider it for parentage; by default accept all
- static bfs(*nodes, **kwargs)[source]¶
Iterate, in a breadth-first search, over nodes and their COW descendants.
- static diff(aroots, broots, akeys, bkeys)[source]¶
Perform a diff operation over two sets of COW hierarchies, identifying common subvolumes based on custom key functions.
Two subvolumes are considered identical if any non-None results of their key functions match.
- Parameters
aroots – the first sequence of COW hierarchies to compare
broots – the second sequence of COW hierarchies to compare
akeys – the sequence of key functions to apply to aroots
bkeys – the sequence of key functions to apply to broots
- Returns
tuple of dicts (coma, comb), indexing, by subvolume uuid, the elements of aroots and broots respectively, which have corresponding identical subvolumes in the other set
Modules
Programmatically generate |
|
Parsers for the output of |