summaryrefslogtreecommitdiff
path: root/include/erebos
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-11-29 20:27:38 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2023-11-29 21:02:55 +0100
commitf097f6473095fa04ff52ac7ee33a8dc435144a6f (patch)
treefd66cda80091a17fadce4d842ac98a1a27ba9abb /include/erebos
parent1ab967bb4be90b10aef8a8521a67302d0e7a67d8 (diff)
Avoid storing zero references and objects
Diffstat (limited to 'include/erebos')
-rw-r--r--include/erebos/storage.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/erebos/storage.h b/include/erebos/storage.h
index 3feb22b..48bedd7 100644
--- a/include/erebos/storage.h
+++ b/include/erebos/storage.h
@@ -174,6 +174,7 @@ public:
PartialRef & operator=(PartialRef &&) = default;
static PartialRef create(const PartialStorage &, const Digest &);
+ static PartialRef zcreate(const PartialStorage &);
const Digest & digest() const;
@@ -234,6 +235,7 @@ private:
ptr(ptr) {}
public:
+ RecordT(): RecordT(std::vector<Item> {}) {}
RecordT(const std::vector<Item> &);
RecordT(std::vector<Item> &&);
std::vector<uint8_t> encode() const;
@@ -420,6 +422,8 @@ public:
std::vector<uint8_t> encode() const;
static ObjectT<S> load(const typename S::Ref &);
+ operator bool() const;
+
std::optional<RecordT<S>> asRecord() const;
std::optional<Blob> asBlob() const;