Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidStrategy = errors.New("Invalid strategy")
ErrInvalidStrategy is returned by `Pool.SetStrategy` when the given strategy is invalid.
Functions ¶
This section is empty.
Types ¶
type Metadata ¶
type Metadata map[string]interface{}
Metadata represents key-value pairs of metadata associated with a Namespace
type Namespace ¶
type Namespace struct { // Domain is the fully-qualified domain name of the Firebase Namespace. // The Domain for the samplechat Namespace mentioned in the Firebase documentation // would be `samplechat.firebaseio-demo.com`. Domain string // Metadata holds any key-value pairs associated with this Namespace; e.g. the admin secret. Metadata Metadata }
Namespace represents a Firebase Namespace (e.g. `<namespace>.firebaseio.com`).
func NewNamespace ¶
NewNamespace returns a Namespace with the given domain.
type Pool ¶
Pool represents a pool of Firebase Namespaces, with an associated Strategy for load balancing in the pool.
func (*Pool) Add ¶
Add inserts the given namespace into the pool.
The Nodes in a Pool are considered to be unordered, so the Namespace is inserted at the "next" position (i.e. a subsequent call to NextRoundRobin would return the inserted Namespace).
func (*Pool) Next ¶
Next returns from the pool the Namespace deemed to be "next" according to the pool's strategy.
func (*Pool) NextRandom ¶
NextRandom returns a random Namespace from the pool
func (*Pool) NextRoundRobin ¶
NextRoundRobin returns a Namespace in "round-robin" fashion
func (*Pool) SetStrategy ¶
SetStrategy sets the strategy of the pool to the given strategy.