Documentation
¶
Index ¶
- Constants
- func NewReader(data interface{}) ([]byte, error)
- func ReconcileData(target interface{}, cachable Cachable, cached []interface{}) error
- type Cachable
- type CacheScope
- type Config
- type Dictionary
- type Host
- type Message
- func (m *Message) BatchSize() int
- func (m *Message) Bytes() []byte
- func (m *Message) CacheHit(index int) bool
- func (m *Message) CacheKey() string
- func (m *Message) CacheKeyAt(index int) string
- func (m *Message) FlagCacheHit(index int)
- func (m *Message) FloatKey(key string, value float32)
- func (m *Message) FloatsKey(key string, values []float32)
- func (m *Message) IntKey(key string, value int)
- func (m *Message) IntsKey(key string, values []int)
- func (m *Message) Release()
- func (m *Message) SetBatchSize(batchSize int)
- func (m *Message) Size() int
- func (m *Message) StringKey(key, value string)
- func (m *Message) StringsKey(key string, values []string)
- type Messages
- type Option
- func WithCacheScope(scope CacheScope) Option
- func WithCacheSize(sizeMB int) Option
- func WithDataStorer(storer datastore.Storer) Option
- func WithDictionary(dictionary *Dictionary) Option
- func WithGmetrics(gmetrics *gmetric.Service) Option
- func WithHashValidation(enable bool) Option
- func WithRemoteConfig(config *cconfig.Remote) Option
- type Releaser
- type Response
- type Service
Constants ¶
const ( CacheScopeLocal = CacheScope(1) CacheScopeL1 = CacheScope(2) CacheScopeL2 = CacheScope(4) )
Variables ¶
This section is empty.
Functions ¶
func ReconcileData ¶
ReconcileData reconciles response with locally cached retrieved data
Types ¶
type Cachable ¶
type Cachable interface { CacheKey() string CacheKeyAt(index int) string BatchSize() int FlagCacheHit(index int) CacheHit(index int) bool }
Cachable returns a cacheable key
type CacheScope ¶
type CacheScope int
func (CacheScope) IsL1 ¶
func (c CacheScope) IsL1() bool
func (CacheScope) IsL2 ¶
func (c CacheScope) IsL2() bool
func (CacheScope) IsLocal ¶
func (c CacheScope) IsLocal() bool
type Config ¶
type Config struct { Hosts []*Host Model string CacheSizeMb int CacheScope *CacheScope Datastore *config.Remote MaxRetry int DictHashValidation bool }
Config represents a client config
type Dictionary ¶
type Dictionary struct {
// contains filtered or unexported fields
}
Dictionary represents Dictionary
func NewDictionary ¶
func NewDictionary(dict *common.Dictionary, inputs []*shared.Field) *Dictionary
NewDictionary creates new Dictionary
func (*Dictionary) KeysLen ¶
func (d *Dictionary) KeysLen() int
type Host ¶
Host represents endpoint host
func (*Host) IsSecurePort ¶
IsSecurePort() returns true if secure port
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a message
func (*Message) CacheKeyAt ¶
CacheKeyAt returns cache key for supplied index
func (*Message) FlagCacheHit ¶
func (*Message) SetBatchSize ¶ added in v0.1.3
func (*Message) StringsKey ¶
StringsKey sets key/values pair
type Messages ¶
type Messages interface {
Borrow() *Message
}
Messages represent a message
func NewMessages ¶
func NewMessages(newDict func() *Dictionary) Messages
NewMessages creates a new message grpcPool
type Option ¶
type Option interface {
Apply(c *Service)
}
Option client option
func WithCacheScope ¶
func WithCacheScope(scope CacheScope) Option
WithCacheScope creates cache scope option
func WithDataStorer ¶
WithDataStorer creates dictionary option
func WithDictionary ¶
func WithDictionary(dictionary *Dictionary) Option
WithDictionary creates dictionary option
func WithGmetrics ¶
WithGmetrics returns gmetric options
func WithHashValidation ¶
WithHashValidation creates a new dict has validation
func WithRemoteConfig ¶
WithCacheScope creates cache scope option
type Response ¶
type Response struct { Status string `json:"status"` Error string `json:"error,omitempty"` ServiceTime time.Duration `json:"serviceTime"` DictHash int `json:"dictHash"` Data interface{} `json:"data"` }
Response represents a response