Documentation ¶
Index ¶
- Constants
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Delete(key []byte) error
- func (c *Conn) Get(key []byte) ([]byte, error)
- func (c *Conn) Keys() ([][]byte, error)
- func (c *Conn) Ping() error
- func (c *Conn) Reconsilate() (net.Conn, error)
- func (c *Conn) Set(key, value []byte) error
- func (c *Conn) Tidy() error
- type Item
- type Metric
- type MetricLog
- type MetricMock
- type Node
- type Options
- type Server
- type Set
- type Store
- func (s *Store) Delete(key []byte) error
- func (s *Store) DeletedLen() int
- func (s *Store) Each(fn func([]byte, []byte) error) (err error)
- func (s *Store) Get(key []byte) ([]byte, error)
- func (s *Store) Len() int
- func (s *Store) Set(key, value []byte) error
- func (s *Store) State() *Set
- func (s *Store) Tidy() error
Constants ¶
const ItemSize = keyHashSize + 8
ItemSize specifies the item size.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn implements a client connection based on the redis protocol.
func (*Conn) Reconsilate ¶
Reconsilate sets the server into reconsilation mode and returns the underlying connection.
type Metric ¶
type Metric interface { CountChanged(int, int) ClientConnected(string) ClientDisconnected(string) PeerConnected(string) PeerDisconnected(string) }
Metric defines the metric interface.
type MetricLog ¶
type MetricLog struct{}
MetricLog defines a metric log.
func (*MetricLog) ClientConnected ¶
ClientConnected is called if a new client connects.
func (*MetricLog) ClientDisconnected ¶
ClientDisconnected is called if a client disconnects.
func (*MetricLog) CountChanged ¶
CountChanged is called if the number of value or deleted values has changed.
func (*MetricLog) PeerConnected ¶
PeerConnected is called if a new peer connects.
func (*MetricLog) PeerDisconnected ¶
PeerDisconnected is called if a peer disconnects.
type MetricMock ¶
type MetricMock struct{}
MetricMock defines a metric mock.
func (*MetricMock) ClientConnected ¶
func (mm *MetricMock) ClientConnected(_ string)
ClientConnected is called if a new client connects.
func (*MetricMock) ClientDisconnected ¶
func (mm *MetricMock) ClientDisconnected(_ string)
ClientDisconnected is called if a client disconnects.
func (*MetricMock) CountChanged ¶
func (mm *MetricMock) CountChanged(valueCount, deletedCount int)
CountChanged is called if the number of value or deleted values has changed.
func (*MetricMock) PeerConnected ¶
func (mm *MetricMock) PeerConnected(_ string)
PeerConnected is called if a new peer connects.
func (*MetricMock) PeerDisconnected ¶
func (mm *MetricMock) PeerDisconnected(_ string)
PeerDisconnected is called if a peer disconnects.
type Node ¶
type Node struct { Store *Store // contains filtered or unexported fields }
Node defines the node.
type Options ¶
type Options struct { // Listener address in format 'tcp://localhost:5000'. ListenURL string // Peer addreses in the format `tcp://localhost:5000`. PeerURLs []string // PeerPingInterval defines the interval in which a peer is pinged in order to test it's availbility. PeerPingInterval time.Duration // PeerReconnectInterval defines a duration after which a failing peer is reconnected. PeerReconnectInterval time.Duration // TidyInterval defines the interval in which the store is cleaned up. TidyInterval time.Duration }
Options defines all deks options.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server defines a server.
func (*Server) AddPeer ¶
func (s *Server) AddPeer( peerURL string, peerPingInterval time.Duration, peerReconnectInterval time.Duration, )
AddPeer adds another node as a target for updates.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set defines a set of items.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store defines a key-value store.
func (*Store) DeletedLen ¶
DeletedLen returns the length of deleted values.