Documentation ¶
Index ¶
- type Config
- type CreateEvent
- type DeleteEvent
- type NetworkDB
- func (nDB *NetworkDB) Close()
- func (nDB *NetworkDB) CreateEntry(tname, nid, key string, value []byte) error
- func (nDB *NetworkDB) DeleteEntry(tname, nid, key string) error
- func (nDB *NetworkDB) GetEntry(tname, nid, key string) ([]byte, error)
- func (nDB *NetworkDB) Join(members []string) error
- func (nDB *NetworkDB) JoinNetwork(nid string) error
- func (nDB *NetworkDB) LeaveNetwork(nid string) error
- func (nDB *NetworkDB) UpdateEntry(tname, nid, key string, value []byte) error
- func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte) bool) error
- func (nDB *NetworkDB) Watch(tname, nid, key string) (chan events.Event, func())
- type UpdateEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // NodeName is the cluster wide unique name for this node. NodeName string // BindAddr is the local node's IP address that we bind to for // cluster communication. BindAddr string // BindPort is the local node's port to which we bind to for // cluster communication. BindPort int }
Config represents the configuration of the networdb instance and can be passed by the caller.
type CreateEvent ¶
type CreateEvent event
CreateEvent generates a table entry create event to the watchers
type DeleteEvent ¶
type DeleteEvent event
DeleteEvent generates a table entry delete event to the watchers
type NetworkDB ¶
NetworkDB instance drives the networkdb cluster and acts the broker for cluster-scoped and network-scoped gossip and watches.
func (*NetworkDB) Close ¶
func (nDB *NetworkDB) Close()
Close destroys this NetworkDB instance by leave the cluster, stopping timers, canceling goroutines etc.
func (*NetworkDB) CreateEntry ¶
CreateEntry creates a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propogates this event to the cluster. It is an error to create an entry for the same tuple for which there is already an existing entry.
func (*NetworkDB) DeleteEntry ¶
DeleteEntry deletes a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propogates this event to the cluster.
func (*NetworkDB) GetEntry ¶
GetEntry retrieves the value of a table entry in a given (network, table, key) tuple
func (*NetworkDB) Join ¶
Join joins this NetworkDB instance with a list of peer NetworkDB instances passed by the caller in the form of addr:port
func (*NetworkDB) JoinNetwork ¶
JoinNetwork joins this node to a given network and propogates this event across the cluster. This triggers this node joining the sub-cluster of this network and participates in the network-scoped gossip and bulk sync for this network.
func (*NetworkDB) LeaveNetwork ¶
LeaveNetwork leaves this node from a given network and propogates this event across the cluster. This triggers this node leaving the sub-cluster of this network and as a result will no longer participate in the network-scoped gossip and bulk sync for this network.
func (*NetworkDB) UpdateEntry ¶
UpdateEntry updates a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propogates this event to the cluster. It is an error to update a non-existent entry.
func (*NetworkDB) WalkTable ¶
WalkTable walks a single table in NetworkDB and invokes the passed function for each entry in the table passing the network, key, value. The walk stops if the passed function returns a true.
type UpdateEvent ¶
type UpdateEvent event
UpdateEvent generates a table entry update event to the watchers