OSTree.MutableTree¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class OSTree.MutableTree(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Private instance structure.
- classmethod new()¶
- Returns:
A new tree
- Return type:
- classmethod new_from_checksum(repo, contents_checksum, metadata_checksum)¶
- Parameters:
repo (
OSTree.Repo
) – The repo which contains the objects refered by the checksums.contents_checksum (
str
) – dirtree checksummetadata_checksum (
str
) – dirmeta checksum
- Returns:
A new tree
- Return type:
Creates a new
OSTree.MutableTree
with the contents taken from the given repo and checksums. The data will be loaded from the repo lazily as needed.New in version 2018.7.
- classmethod new_from_commit(repo, rev)¶
- Parameters:
repo (
OSTree.Repo
) – The repo which contains the objects refered by the checksums.rev (
str
) – ref or SHA-256 checksum
- Raises:
- Returns:
A new tree
- Return type:
Creates a new
OSTree.MutableTree
with the contents taken from the given commit. The data will be loaded from the repo lazily as needed.New in version 2021.5.
- check_error()¶
- Raises:
- Returns:
TRUE
on success- Return type:
In some cases, a tree may be in a “lazy” state that loads data in the background; if an error occurred during a non-throwing API call, it will have been cached. This function checks for a cached error. The tree remains in error state.
New in version 2018.7.
- ensure_dir(name)¶
- Parameters:
name (
str
) – Name of subdirectory of self to retrieve/creates- Raises:
- Returns:
- out_subdir:
the subdirectory
- Return type:
(
bool
, out_subdir:OSTree.MutableTree
)
Returns the subdirectory of self with filename name, creating an empty one it if it doesn’t exist.
- ensure_parent_dirs(split_path, metadata_checksum)¶
- Parameters:
- Raises:
- Returns:
- out_parent:
The parent tree
- Return type:
(
bool
, out_parent:OSTree.MutableTree
)
Create all parent trees necessary for the given split_path to exist.
- fill_empty_from_dirtree(repo, contents_checksum, metadata_checksum)¶
- Parameters:
repo (
OSTree.Repo
) –contents_checksum (
str
) –metadata_checksum (
str
) –
- Returns:
True
if merge was successful,False
if it was not possible.This function enables optimisations when composing trees. The provided checksums are not loaded or checked when this function is called. Instead the contents will be loaded only when needed.
- Return type:
Merges self with the tree given by contents_checksum and metadata_checksum, but only if it’s possible without writing new objects to the repo. We can do this if either self is empty, the tree given by contents_checksum is empty or if both trees already have the same contents_checksum.
New in version 2018.7.
- get_subdirs()¶
- Returns:
All children directories
- Return type:
- lookup(name)¶
- Parameters:
name (
str
) – name- Raises:
- Returns:
True
on success and either out_file_checksum or out_subdir are filled,False
otherwise.- out_file_checksum:
checksum
- out_subdir:
subdirectory
- Return type:
(
bool
, out_file_checksum:str
orNone
, out_subdir:OSTree.MutableTree
orNone
)
Lookup name and returns out_file_checksum or out_subdir depending on its file type.
- remove(name, allow_noent)¶
- Parameters:
- Raises:
- Return type:
Remove the file or subdirectory named name from the mutable tree self.
New in version 2018.9.
- replace_file(name, checksum)¶
- Parameters:
- Raises:
- Return type:
- walk(split_path, start)¶
- Parameters:
- Raises:
- Returns:
- out_subdir:
Target parent
- Return type:
(
bool
, out_subdir:OSTree.MutableTree
)
Traverse start number of elements starting from split_path; the child will be returned in out_subdir.