Skip to content

Commit

Permalink
Add the normal fdb_archive function in addition to fdb_archive_multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHodson committed Nov 13, 2024
1 parent 0d6c2a4 commit daf6c19
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pyfdb/pyfdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,16 @@ def archive(self, data, request=None) -> None:
else:
lib.fdb_archive_multiple(self.ctype, Request(request).ctype, ffi.from_buffer(data), len(data))

def archive_single(self, data, request) -> None:
"""Archive data into the FDB5 database
Args:
data (bytes): bytes data to be archived
request (dict | None): dictionary representing the request to be associated with the data,
if not provided the key will be constructed from the data.
"""
lib.fdb_archive(self.ctype, Key(request).ctype, ffi.from_buffer(data), len(data))

def flush(self) -> None:
"""Flush any archived data to disk"""
lib.fdb_flush(self.ctype)
Expand Down

0 comments on commit daf6c19

Please sign in to comment.