Skip to content

Module hb_store_remote_node.erl

A store module that reads data from another AO node.

Description

Notably, this store only provides the read side of the store interface. The write side could be added, returning an commitment that the data has been written to the remote node. In that case, the node would probably want to upload it to an Arweave bundler to ensure persistence, too.

Function Index

make_link/3Link a source to a destination in the remote node.
read/2Read a key from the remote node.
read_test/0*Test that we can create a store, write a random message to it, then start a remote node with that store, and read the message from it.
resolve/2Resolve a key path in the remote store.
scope/1Return the scope of this store.
type/2Determine the type of value at a given key.
write/3Write a key to the remote node.

Function Details

make_link/3

make_link(Opts, Source, Destination) -> any()

Link a source to a destination in the remote node.

Constructs an HTTP POST link request. If a wallet is provided, the message is signed. Returns {ok, Path} on HTTP 200, or {error, Reason} on failure.

read/2

read(Opts, Key) -> any()

Read a key from the remote node.

Makes an HTTP GET request to the remote node and returns the committed message.

read_test/0 *

read_test() -> any()

Test that we can create a store, write a random message to it, then start a remote node with that store, and read the message from it.

resolve/2

resolve(X1, Key) -> any()

Resolve a key path in the remote store.

For the remote node store, the key is returned as-is.

scope/1

scope(Arg) -> any()

Return the scope of this store.

For the remote store, the scope is always remote.

type/2

type(Opts, Key) -> any()

Determine the type of value at a given key.

Remote nodes support only the simple type or not_found.

write/3

write(Opts, Key, Value) -> any()

Write a key to the remote node.

Constructs an HTTP POST write request. If a wallet is provided, the message is signed. Returns {ok, Path} on HTTP 200, or {error, Reason} on failure.