From 6e6836e7885259b731651ae172bd6313edae7cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 8 Jan 2024 21:52:29 +0100 Subject: Storage: add storage() accessor to Head --- include/erebos/storage.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/erebos/storage.h b/include/erebos/storage.h index 48bedd7..96a27d4 100644 --- a/include/erebos/storage.h +++ b/include/erebos/storage.h @@ -649,6 +649,7 @@ public: UUID id() const { return mid; } const Stored & stored() const { return mstored; } const Ref & ref() const { return mstored.ref(); } + const Storage & storage() const { return mstored.ref().storage(); } optional> reload() const; std::optional> update(const std::function(const Stored &)> &) const; @@ -769,7 +770,7 @@ Head Storage::storeHead(const Stored & val) const template optional> Head::reload() const { - return ref().storage().template head(id()); + return storage().template head(id()); } template @@ -789,7 +790,7 @@ std::optional> Head::update(const std::function(const Store template WatchedHead Head::watch(const std::function &)> & watcher) const { - int wid = stored().ref().storage().watchHead(T::headTypeId, id(), [id = id(), watcher] (const Ref & ref) { + int wid = storage().watchHead(T::headTypeId, id(), [id = id(), watcher] (const Ref & ref) { watcher(Head(id, ref)); }); return WatchedHead(*this, wid); @@ -808,7 +809,7 @@ template WatchedHead::~WatchedHead() { if (watcherId >= 0) - Head::stored().ref().storage().unwatchHead( + Head::storage().unwatchHead( T::headTypeId, Head::id(), watcherId); } -- cgit v1.2.3