OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-storage commits / 2462fbf

provide message for read-only open.
2462fbf6a22f5d2313cf6ed6cb334f46cca20ef0
by Linas Vepstas <linasvepstas@gmail.com> · 2026-01-20T17:38:12.000Z

Changed files (2) +22 -0

opencog/persist/api/StorageNode.cc +16 -0
……@@ -101,6 +101,8 @@ void StorageNode::setValue(const Handle& key, const ValuePtr& value)
101101 // branching, instead of string compare.
102102 static constexpr uint32_t p_open =
103103 dispatch_hash("*-open-*");
104 static constexpr uint32_t p_open_ro =
105 dispatch_hash("*-open-ro-*");
104106 static constexpr uint32_t p_close =
105107 dispatch_hash("*-close-*");
106108
……@@ -168,6 +170,14 @@ void StorageNode::setValue(const Handle& key, const ValuePtr& value)
168170 open();
169171 return;
170172 }
173 case p_open_ro: {
174 COLL("*-open-ro-*");
175 AtomSpace* as = get_target_as(value);
176 if (nullptr == as) as = getAtomSpace();
177 _target_as = as;
178 open_read_only();
179 return;
180 }
171181 case p_close:
172182 COLL("*-close-*");
173183 close();
……@@ -539,6 +549,12 @@ void StorageNode::proxy_close(void)
539549 "This StorageNode does not implement proxying!");
540550}
541551
552void StorageNode::open_read_only(void)
553{
554 throw RuntimeException(TRACE_INFO,
555 "This StorageNode does not support read-only opening!");
556}
557
542558void StorageNode::set_proxy(const Handle&)
543559{
544560 throw RuntimeException(TRACE_INFO,
opencog/persist/api/StorageNode.h +6 -0
……@@ -80,6 +80,11 @@ public:
8080 */
8181 virtual void open(void) = 0;
8282
83 /**
84 * Open a read-only connection to the indicated URI.
85 */
86 virtual void open_read_only(void);
87
8388 /**
8489 * Close an active connection.
8590 */
……@@ -340,6 +345,7 @@ public:
340345protected:
341346 static constexpr const char* _messages[] = {
342347 "*-open-*",
348 "*-open-ro-*",
343349 "*-close-*",
344350 "*-load-atomspace-*",
345351 "*-store-atomspace-*",