-
Notifications
You must be signed in to change notification settings - Fork 0
metastore API
Version: Pre-alpha
Squad's metastore package is a p2p storage system built using Holochain.
Create a new websocket connection to the metastore.
Inputs: uri
(string, websocket url to connect to)
Outputs: squad.connection
(the new websocket connection)
Set callback to be run when the websocket connection returns a particular message.
Inputs:
-
message
: string (output to look for from the websocket connection) -
f
: function (runs when themessage
is received)
Example:
metastore.on('open', () => {
console.log("TESTING METASTORE API...")
})
Create a new definition
metadata entry in the shared metastore.
Inputs: definition
Outputs: Holochain address (the address of the new definition in the metastore)
Get a definition from the metastore using its Holochain address.
Inputs: Holochain address
Outputs: definition
(TBD -- change this to getDefinitionAddress
)
Get the Holochain addresses of the definitions in a specific catalog.
Inputs:
-
catalog_type
: string (definition-type the catalog stores -- "Game", "Component," etc.) -
catalog_name
: string (name of the catalog -- base catalogs are "[catalog_type]-Catalog")
Outputs: List of addresses
Get all definitions of a certain type from the base catalog for that type.
Inputs: catalog_type
(string, definition-type the catalog stores -- "Game", "Component," etc.)
Outputs: List of definitions
Get definitions from a specific catalog.
Inputs:
-
catalog_type
: string (definition-type the catalog stores -- "Game", "Component," etc.) -
catalog_name
: string (name of the catalog -- base catalogs are "[catalog_type]-Catalog")
Outputs: List of definitions
Close the websocket connection.
A networking shim allowing the metastore to share data peer-to-peer.
Create an IPFS node.
Inputs: url
(the URL the IPFS node repo will be associated to)
Outputs: A new IPFS object
Subscribe to the IPFS node and periodically share metadata to it.
Inputs:
-
node
: IPFS object -
TOPIC
: string (topic to share and retrieve IPFS data through) -
typeArray
: array of strings (the metadata types to be shared and retrieved -- definition types: "Format", "Game", etc.) -
shareFunction
: function (to plug data into when retrieved, generally asubmitDefinition
function)
.