Trait Gate

Source
pub trait Gate {
    // Required methods
    fn attached(&self) -> Vec<(NodeInfo, u32)>;
    fn total_cursors(&self) -> u32;
    fn query_hook(&self, doc: &Hash, hook: Box<dyn QueryHook>);
    fn close(self);
}
Expand description

An open Gate. Allows other nodes in a network to read the database with a cursor, starting from the hash at which the gate was opened. Any document that can be navigated to is thus visible to other nodes. An exception is for some entries - certain entries may be marked with a policy that further limits visibility to the network, and those entries will not be available for cursor navigation.

Required Methods§

Source

fn attached(&self) -> Vec<(NodeInfo, u32)>

Get a list of what nodes are currently actively using a cursor within this gate, and how many cursors they have open.

Source

fn total_cursors(&self) -> u32

How many cursors are currently open on this gate.

Source

fn query_hook(&self, doc: &Hash, hook: Box<dyn QueryHook>)

Add a hook for handling all incoming queries on a specific document, scoped to just nodes that came in through this Gate. When a hook is established, all queries go through it - none will ever hit the database. It’s up to the hook to pass queries on to the database, should it choose to do so.

Source

fn close(self)

Explicitly close the gate - should be equivalent to calling drop(gate).

Implementors§