Documentation ΒΆ
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type Client ΒΆ
type Client struct { *ClientState // NodeID identifies this node's data NodeID string // Primary is a client connected to the primary instance Primary *redis.Client // Secondary is a client connected to the secondary instance Secondary *redis.Client ShareTicker *time.Ticker // ScrapeTicker defines how frequently values are downloaded ScrapeTicker *time.Ticker // OnScrape is called when an attempt to scrape values is complete. OnScrape OnScrapeCallback OnShare OnShareCallback }
Client is an interface to a Redis cluster that allows for easy sharing of values
func NewDefaultClient ΒΆ
func NewDefaultClient(primaryAddr, secondaryAddr string, onScrape OnScrapeCallback) *Client
NewDefaultClient builds a Client with a configuration that should work for most cases
func (*Client) Scrape ΒΆ
func (c *Client) Scrape()
Scrape downloads values for all local keys from the secondary
func (*Client) Set ΒΆ
Set sets a value internally which will be uploaded via the connection to the primary
func (*Client) StartScraping ΒΆ
func (c *Client) StartScraping()
StartScraping periodically downloads shared values from the secondary. It should be started as a goroutine. There is no support for stopping.
func (*Client) StartSharing ΒΆ
func (c *Client) StartSharing()
StartSharing starts a goroutine that periodically uploads shared values to the primary
type ClientState ΒΆ
type ClientState struct {
// contains filtered or unexported fields
}
ClientState is the internal state of the client
type LocalValueMap ΒΆ
LocalValueMap is a map containing this node's local representation of each value to be shared and scraped
type OnScrapeCallback ΒΆ
type OnScrapeCallback = func(error, ScrapedValuesMap)
OnScrapeCallback is called when values are scraped
type OnShareCallback ΒΆ
type OnShareCallback = func(error)
OnShareCallback is called when values are shared
type ScrapedValuesMap ΒΆ
type ScrapedValuesMap map[string]SharedValueMap
ScrapedValuesMap is a map from each shared key to the SharedValueMap containing each node's value for that key
type SharedValueMap ΒΆ
SharedValueMap is a map containing each node's representation of a value, indexed by the node's ID