summaryrefslogtreecommitdiff
path: root/database.cpp
diff options
context:
space:
mode:
authorJosh F <josh@vector35.com>2022-10-06 18:52:48 -0400
committerJosh F <josh@vector35.com>2022-10-06 18:52:48 -0400
commit309fc943fb48d9ce4f6f7c59f7d66bf0ca69eef1 (patch)
treeb8740bc3c99e137976490c25c2b1bf0040c9bfd3 /database.cpp
parent847c305528b2af050ccf8ef93a087d40b07bcd3a (diff)
Add APIs for checking and writing snapshot data
Diffstat (limited to 'database.cpp')
-rw-r--r--database.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/database.cpp b/database.cpp
index ba20e02b..e60e0d92 100644
--- a/database.cpp
+++ b/database.cpp
@@ -390,6 +390,19 @@ int64_t Database::WriteSnapshotData(std::vector<int64_t> parents, Ref<BinaryView
}
+bool Database::StoreDataForSnapshot(int64_t id, const Ref<KeyValueStore>& data, const std::function<bool(size_t, size_t)>& progress)
+{
+ ProgressContext pctxt;
+ pctxt.callback = progress;
+ bool result = BNStoreDataForSnapshot(m_object, id, data->GetObject(), &pctxt, ProgressCallback);
+ if (!result)
+ {
+ throw DatabaseException("BNStoreDataForSnapshot");
+ }
+ return result;
+}
+
+
void Database::TrimSnapshot(int64_t id)
{
if (!BNTrimDatabaseSnapshot(m_object, id))
@@ -518,3 +531,9 @@ void Database::WriteAnalysisCache(Ref<KeyValueStore> val)
throw DatabaseException("BNWriteDatabaseAnalysisCache");
}
}
+
+
+bool Database::SnapshotHasData(int64_t id)
+{
+ return BNSnapshotHasData(m_object, id);
+}