CogStorageNode

From OpenCog

The CogStorageNode is a StorageNode that can save/restore Atoms to an AtomSpace running a CogServer. It uses exactly the same API as all the other StorageNodes; see StorageNode for details.

The CogStorageNode provides inter-AtomSpace point-to-point networking. That is, it provides a way of moving (copying) Atoms from one network location to another. It does this by leveraging the CogServer for the network communications, and the fast file format (here: /opencog/persist/sexpr) pumped over a socket to gain extremely high performance (the highest possible, as far as we can figure it out).

The CogSimpleStorageNode is functionally equivalent to the CogStorageNode, except that it provides an extremely simple implementation. This makes it very easy to read and understand; it can be used as a template or a guideline for creating other StorageNodes. The implementation can be found here: https://github.com/opencog/atomspace-cog/

Users who want to have a networked, multi-user distributed AtomSpace are encouraged to use RocksStorageNode together with CogStorageNode to provide networking. Creating a true distributed AtomSpace with this infrastructure also requires having some policy agents that decide which atoms to move around, where to move/copy them to, and how often they need to be moved/copied. See the wiki page Networked AtomSpaces for basic definitions of networking terms, as they apply to AtomSpaces. A pre-pre-alpha project to implement some of these agents has been created here: https://github.com/opencog/atomspace-agents/ .

Example

Here's a very short example that opens a connection to a CogServer running on localhost, and fetches all of the Values attached to a given Atom.

(define csn (CogStorageNode "cog://127.0.0.1"))
(cog-open csn)
(fetch-atom (Concept "foo") csn)
(cog-close csn)

Complete, functional demos are provided in the github examples directory.

URL format

The URL format simply specifies a TCP/IP hostname or a dotted IPv4 address. Some examples:

cog://192.168.1.1
cog://192.168.1.1:17001
cog://example.com:17003

The general format is

cog://hostname:port

If the port is not specified, then the default cogserver port 17001 is assumed.

See also