From 6d30fca932b0ae0f0b27a80a245ab74754ace09b Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 13 Apr 2022 22:49:08 -0400 Subject: Better docstring for Database.trim/remove_snapshot --- python/database.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'python/database.py') 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]: -- cgit v1.3.1