get

Reads a node, or some of its properties, from memory, storage or the network.

Parameter

Description

lex

A lex query with the node id as "#", and optionally which properties to return as ".".

callback

Function that receives a message object, see below.

options

Optional object. Mostly used internally and by tests, the Holster API provides the defaults it needs.

The callback receives a message with a put property holding the result in graph format, keyed by node id. A node that isn't found is null, and a message with an err property means the request failed.

Examples

// A whole node.
holster.wire.get({"#": "root"}, msg => console.log(msg.put))

// One property.
holster.wire.get({"#": "root", ".": "key"}, msg => {
  console.log(msg.put.root.key)
})

// Only data that's already in memory.
holster.wire.get({"#": "root"}, msg => console.log(msg.put), {fast: true})

The second example returns:

{
  root: {
    _: {"#": "root", ">": {key: 1792812535294}},
    key: "value",
  },
}

Options

Option

Description

fast

Only return data that's already in memory. Faster, but a node that has only been partly loaded is returned as it is.