store

package
v0.0.0-...-9f36605 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2018 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterInfo

type ClusterInfo struct {
	Whoami  string
	Ready   bool
	Uptime  time.Duration
	Members []string
}

type Option

type Option func(*options)

func WithApiSecret

func WithApiSecret(secret string) Option

func WithBucketSize

func WithBucketSize(buckets int) Option

func WithClock

func WithClock(clock clock.Clock) Option

func WithClusterName

func WithClusterName(name string) Option

func WithGcGrace

func WithGcGrace(gcgrace int) Option

func WithGcInterval

func WithGcInterval(gcinterval int) Option

func WithHostName

func WithHostName(hostName string) Option

func WithHttpPort

func WithHttpPort(port string) Option

func WithNodeId

func WithNodeId(nodeId string) Option

func WithRingpop

func WithRingpop(ringpop *ringpop.Ringpop) Option

func WithSeed

func WithSeed(seeds string) Option

func WithStatDEnabled

func WithStatDEnabled(enable bool) Option

func WithStatsDBucket

func WithStatsDBucket(bucket string) Option

func WithStatsDHostPort

func WithStatsDHostPort(hostport string) Option

func WithStatsDSampleRate

func WithStatsDSampleRate(rate float32) Option

func WithSyncBuffer

func WithSyncBuffer(bufferSize int) Option

func WithTChannel

func WithTChannel(tchannel *tchannel.Channel) Option

func WithTChannelPort

func WithTChannelPort(port string) Option

func WithUnsyncedCtrLimit

func WithUnsyncedCtrLimit(limit int32) Option

func WithUnsyncedTimeLimit

func WithUnsyncedTimeLimit(limit int) Option

type RateConfig

type RateConfig struct {
	Window       int32 //in seconds
	Limit        int32
	PeakAveraged bool
}

type Store

type Store struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStore

func NewStore(opt ...Option) *Store

func (*Store) Close

func (s *Store) Close()

func (*Store) GetClusterInfo

func (cs *Store) GetClusterInfo() *ClusterInfo

func (*Store) GetRateConfig

func (s *Store) GetRateConfig(key string) *RateConfig

func (*Store) GetRateConfigAll

func (s *Store) GetRateConfigAll() map[string]*RateConfig

func (*Store) Handle

func (s *Store) Handle(e event.Event)

func (*Store) HandleEvent

func (cs *Store) HandleEvent(event events.Event)

func (*Store) Incr

func (s *Store) Incr(key string, count int32, threshold int32, window int32, peakaveraged bool) bool

func (*Store) IncrAction

func (cs *Store) IncrAction(ctx thrift.Context, key string, count int32, threshold int32, window int32, peakaveraged bool) (bool, error)

func (*Store) IsAuthorised

func (s *Store) IsAuthorised(secret string) bool

func (*Store) LoadRateConfig

func (s *Store) LoadRateConfig()

func (*Store) RateLimitGlobal

func (s *Store) RateLimitGlobal(key string, count int32) bool

func (*Store) RateLimitGlobalAction

func (cs *Store) RateLimitGlobalAction(ctx thrift.Context, key string, count int32) (bool, error)

func (*Store) SaveRateConfig

func (s *Store) SaveRateConfig()

func (*Store) SendSyncRateConfigToNode

func (cs *Store) SendSyncRateConfigToNode(node string, key string, rateConfig *RateConfig) error

func (*Store) SendSyncToNode

func (cs *Store) SendSyncToNode(node string, syncs []*com.SyncCommand) error

func (*Store) SetRateConfig

func (s *Store) SetRateConfig(key string, rateConfig RateConfig)

func (*Store) StatsDClient

func (s *Store) StatsDClient() *statsd.Client

func (*Store) SyncKeys

func (s *Store) SyncKeys(ctx thrift.Context, syncs []*com.SyncCommand) error

func (*Store) SyncRateConfig

func (cs *Store) SyncRateConfig(ctx thrift.Context, key string, threshold int32, window int32, peakaveraged bool) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL