redis

package
v3.0.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const ErrorHashNotPresent = "hash-not-present"

ErrorHashNotPresent constant

Variables

This section is empty.

Functions

func NewRedisClient

func NewRedisClient(config *conf.RedisConfig, logger logging.LoggerInterface) (*redis.PrefixedRedisClient, error)

NewRedisClient returns a new Prefixed Redis Client

Types

type EventsStorage

type EventsStorage struct {
	// contains filtered or unexported fields
}

EventsStorage redis implementation of EventsStorage interface

func NewEventStorageConsumer

func NewEventStorageConsumer(redisClient *redis.PrefixedRedisClient, metadata dtos.Metadata, logger logging.LoggerInterface) *EventsStorage

NewEventStorageConsumer storage for consumer

func NewEventsStorage

func NewEventsStorage(redisClient *redis.PrefixedRedisClient, metadata dtos.Metadata, logger logging.LoggerInterface) *EventsStorage

NewEventsStorage returns an instance of RedisEventsStorage

func (*EventsStorage) Count

func (r *EventsStorage) Count() int64

Count returns the number of items in the redis list

func (*EventsStorage) Drop

func (r *EventsStorage) Drop(size *int64) error

Drop drops events from queue

func (*EventsStorage) Empty

func (r *EventsStorage) Empty() bool

Empty returns true if redis list is zero length

func (*EventsStorage) PopN

func (r *EventsStorage) PopN(n int64) ([]dtos.EventDTO, error)

PopN return N elements from 0 to N

func (*EventsStorage) PopNWithMetadata

func (r *EventsStorage) PopNWithMetadata(n int64) ([]dtos.QueueStoredEventDTO, error)

PopNWithMetadata pop N elements from queue

func (*EventsStorage) Push

func (r *EventsStorage) Push(event dtos.EventDTO, _ int) error

Push events into Redis LIST data type with RPUSH command

type ImpressionStorage

type ImpressionStorage struct {
	// contains filtered or unexported fields
}

ImpressionStorage is a redis-based implementation of split storage

func NewImpressionStorage

func NewImpressionStorage(client *redis.PrefixedRedisClient, metadata dtos.Metadata, logger logging.LoggerInterface) *ImpressionStorage

NewImpressionStorage creates a new RedisSplitStorage and returns a reference to it

func (*ImpressionStorage) Count

func (r *ImpressionStorage) Count() int64

Count returns the size of the impressions queue

func (*ImpressionStorage) Drop

func (r *ImpressionStorage) Drop(size *int64) error

Drop drops impressions from queue

func (*ImpressionStorage) Empty

func (r *ImpressionStorage) Empty() bool

Empty returns true if redis list is zero length

func (*ImpressionStorage) LogImpressions

func (r *ImpressionStorage) LogImpressions(impressions []dtos.Impression) error

LogImpressions stores impressions in redis as Queue

func (*ImpressionStorage) PopN

func (r *ImpressionStorage) PopN(n int64) ([]dtos.Impression, error)

PopN return N elements from 0 to N

func (*ImpressionStorage) PopNRaw

func (r *ImpressionStorage) PopNRaw(n int64) ([]string, error)

func (*ImpressionStorage) PopNWithMetadata

func (r *ImpressionStorage) PopNWithMetadata(n int64) ([]dtos.ImpressionQueueObject, error)

PopNWithMetadata pop N elements from queue

type MetricsStorage

type MetricsStorage struct {
	// contains filtered or unexported fields
}

MetricsStorage is a redis-based implementation of split storage

func NewMetricsStorage

func NewMetricsStorage(redisClient *redis.PrefixedRedisClient, metadata dtos.Metadata, logger logging.LoggerInterface) *MetricsStorage

NewMetricsStorage creates a new RedisSplitStorage and returns a reference to it

func (*MetricsStorage) IncCounter

func (r *MetricsStorage) IncCounter(metric string)

IncCounter incraeses the count for a specific metric

func (*MetricsStorage) IncLatency

func (r *MetricsStorage) IncLatency(metric string, index int)

IncLatency incraeses the latency of a bucket for a specific metric

func (*MetricsStorage) PeekCounters

func (r *MetricsStorage) PeekCounters() map[string]int64

PeekCounters returns Counters

func (*MetricsStorage) PeekLatencies

func (r *MetricsStorage) PeekLatencies() map[string][]int64

PeekLatencies returns Latencies

func (*MetricsStorage) PopCounters

func (r *MetricsStorage) PopCounters() []dtos.CounterDTO

PopCounters some

func (*MetricsStorage) PopCountersWithMetadata

func (r *MetricsStorage) PopCountersWithMetadata() (*dtos.CounterDataBulk, error)

PopCountersWithMetadata returns counter values saved in Redis by SDKs

func (*MetricsStorage) PopGauges

func (r *MetricsStorage) PopGauges() []dtos.GaugeDTO

PopGauges some

func (*MetricsStorage) PopGaugesWithMetadata

func (r *MetricsStorage) PopGaugesWithMetadata() (*dtos.GaugeDataBulk, error)

PopGaugesWithMetadata returns gauges values saved in Redis by SDKs

func (*MetricsStorage) PopLatencies

func (r *MetricsStorage) PopLatencies() []dtos.LatenciesDTO

PopLatencies some

func (*MetricsStorage) PopLatenciesWithMetadata

func (r *MetricsStorage) PopLatenciesWithMetadata() (*dtos.LatencyDataBulk, error)

PopLatenciesWithMetadata returns latency values saved in Redis by SDKs

func (*MetricsStorage) PutGauge

func (r *MetricsStorage) PutGauge(key string, gauge float64)

PutGauge stores a gauge in redis

type MiscStorage

type MiscStorage struct {
	// contains filtered or unexported fields
}

MiscStorage provides methods to handle the synchronizer's initialization procedure

func NewMiscStorage

func NewMiscStorage(client *redis.PrefixedRedisClient, logger logging.LoggerInterface) *MiscStorage

NewMiscStorage creates a new MiscStorageAdapter and returns a reference to it

func (*MiscStorage) ClearAll

func (m *MiscStorage) ClearAll() error

ClearAll cleans previous used data

func (*MiscStorage) GetApikeyHash

func (m *MiscStorage) GetApikeyHash() (string, error)

GetApikeyHash gets hashed apikey from redis

func (*MiscStorage) SetApikeyHash

func (m *MiscStorage) SetApikeyHash(newApikeyHash string) error

SetApikeyHash sets hashed apikey in redis

type SegmentStorage

type SegmentStorage struct {
	// contains filtered or unexported fields
}

SegmentStorage is a redis implementation of a storage for segments

func NewSegmentStorage

func NewSegmentStorage(redisClient *redis.PrefixedRedisClient, logger logging.LoggerInterface) *SegmentStorage

NewSegmentStorage creates a new RedisSegmentStorage and returns a reference to it

func (*SegmentStorage) ChangeNumber

func (r *SegmentStorage) ChangeNumber(segmentName string) (int64, error)

ChangeNumber returns the changeNumber for a particular segment

func (*SegmentStorage) CountRemovedKeys

func (r *SegmentStorage) CountRemovedKeys(segmentName string) int64

CountRemovedKeys method

func (*SegmentStorage) Keys

func (r *SegmentStorage) Keys(segmentName string) *set.ThreadUnsafeSet

Keys returns segments keys for segment if it's present

func (*SegmentStorage) SegmentContainsKey

func (r *SegmentStorage) SegmentContainsKey(segmentName string, key string) (bool, error)

SegmentContainsKey returns true if the segment contains a specific key

func (*SegmentStorage) SetChangeNumber

func (r *SegmentStorage) SetChangeNumber(segmentName string, changeNumber int64) error

SetChangeNumber sets the till value belong to segmentName

func (*SegmentStorage) Update

func (r *SegmentStorage) Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, till int64) error

Update adds a new segment

type SplitStorage

type SplitStorage struct {
	// contains filtered or unexported fields
}

SplitStorage is a redis-based implementation of split storage

func NewSplitStorage

func NewSplitStorage(redisClient *redis.PrefixedRedisClient, logger logging.LoggerInterface) *SplitStorage

NewSplitStorage creates a new RedisSplitStorage and returns a reference to it

func (*SplitStorage) All

func (r *SplitStorage) All() []dtos.SplitDTO

All returns a slice of splits dtos.

func (*SplitStorage) ChangeNumber

func (r *SplitStorage) ChangeNumber() (int64, error)

ChangeNumber returns the latest split changeNumber

func (*SplitStorage) FetchMany

func (r *SplitStorage) FetchMany(features []string) map[string]*dtos.SplitDTO

FetchMany retrieves features from redis storage

func (*SplitStorage) KillLocally

func (r *SplitStorage) KillLocally(splitName string, defaultTreatment string, changeNumber int64)

KillLocally mock

func (*SplitStorage) PutMany

func (r *SplitStorage) PutMany(splits []dtos.SplitDTO, changeNumber int64)

PutMany bulk stores splits in redis

func (*SplitStorage) Remove

func (r *SplitStorage) Remove(splitName string)

Remove removes split item from redis

func (*SplitStorage) SegmentNames

func (r *SplitStorage) SegmentNames() *set.ThreadUnsafeSet

SegmentNames returns a slice of strings with all the segment names

func (*SplitStorage) SetChangeNumber

func (r *SplitStorage) SetChangeNumber(changeNumber int64) error

SetChangeNumber sets the till value belong to segmentName

func (*SplitStorage) Split

func (r *SplitStorage) Split(feature string) *dtos.SplitDTO

Split fetches a feature in redis and returns a pointer to a split dto

func (*SplitStorage) SplitNames

func (r *SplitStorage) SplitNames() []string

SplitNames returns a slice of strings with all the split names

func (*SplitStorage) TrafficTypeExists

func (r *SplitStorage) TrafficTypeExists(trafficType string) bool

TrafficTypeExists returns true or false depending on existence and counter of trafficType

Jump to

Keyboard shortcuts

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