Documentation
¶
Index ¶
- type Cache
- func (c *Cache) Close()
- func (c *Cache) Delete(key string)
- func (c *Cache) Get(key string) ([]byte, bool)
- func (c *Cache) GetBroadcasts(overhead, limit int) [][]byte
- func (c *Cache) LocalState(join bool) []byte
- func (c *Cache) Memberlist() *memberlist.Memberlist
- func (c *Cache) MergeRemoteState(buf []byte, join bool)
- func (c *Cache) NodeMeta(limit int) []byte
- func (c *Cache) NotifyMsg(b []byte)
- func (c *Cache) Set(key string, value []byte, ttl time.Duration)
- type Entry
- type GossipMessage
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func New ¶
func New(ml *memberlist.Memberlist, opts Options) *Cache
New uses an existing memberlist. Caller owns ml.
func NewWithConfig ¶
func NewWithConfig(cfg *memberlist.Config, opts Options) (*Cache, error)
func (*Cache) GetBroadcasts ¶
func (*Cache) LocalState ¶
func (*Cache) Memberlist ¶
func (c *Cache) Memberlist() *memberlist.Memberlist
Memberlist uses the underlying memberlist
func (*Cache) MergeRemoteState ¶
type Entry ¶
type Entry struct {
Value []byte
Version uint64 // last right wins prim clock
ExpireAt time.Time // zero default = no ttl
Tombstone bool // true == deleted
OriginID string // Comparison for tiebreaker
}
Entry is the local KV state.
type GossipMessage ¶
type GossipMessage struct {
Key string
Value []byte
Version uint64
ExpireAt time.Time
Tombstone bool
// Tie-break when versions collide
OriginID string // stable node ID UUID or addr
}
GossipMessage is the wire format.
type Options ¶
type Options struct {
OriginID string
RetransmitMult int
SweepInterval time.Duration
// Adaptive gossip options
AdaptiveGossip bool
DecayInterval time.Duration
GossipFloor time.Duration
// Explicit rate thresholds
HighRateThreshold int64 // Messages/sec for aggressive gossip (default 50)
MediumRateThreshold int64 // Messages/sec for normal gossip (default 10)
LowRateThreshold int64 // Messages/sec for probabilistic gossip (default 1)
}
Click to show internal directories.
Click to hide internal directories.