summaryrefslogtreecommitdiff
path: root/python/database.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-04-13 22:49:08 -0400
committerGlenn Smith <glenn@vector35.com>2022-04-13 22:49:08 -0400
commit6d30fca932b0ae0f0b27a80a245ab74754ace09b (patch)
tree93d1827c03953a9be2207fb9fb5e21879a2be82d /python/database.py
parent43730ec61dc280d0915a9db0fdbd38bb1cdc8f9a (diff)
Better docstring for Database.trim/remove_snapshot
Diffstat (limited to 'python/database.py')
-rw-r--r--python/database.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/python/database.py b/python/database.py
index f1aefb6a..226079ab 100644
--- a/python/database.py
+++ b/python/database.py
@@ -280,12 +280,20 @@ class Database:
core.BNSetDatabaseCurrentSnapshot(self.handle, value.id)
def trim_snapshot(self, id: int):
- """Trim a snapshot's contents in the database by id, but leave the """
- core.BNRemoveDatabaseSnapshot(self.handle, id)
+ """
+ Trim a snapshot's contents in the database by id, but leave the parent/child
+ hierarchy intact. Future references to this snapshot will return False for has_contents
+ """
+ if not core.BNRemoveDatabaseSnapshot(self.handle, id):
+ raise RuntimeError("BNRemoveDatabaseSnapshot returned False")
def remove_snapshot(self, id: int):
- """Remove a snapshot in the database by id"""
- core.BNRemoveDatabaseSnapshot(self.handle, id)
+ """
+ Remove a snapshot in the database by id, deleting its contents and references.
+ Attempting to remove a snapshot with children will raise an exception.
+ """
+ if not core.BNRemoveDatabaseSnapshot(self.handle, id):
+ raise RuntimeError("BNRemoveDatabaseSnapshot returned False")
@property
def global_keys(self) -> List[str]: