store

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStorage

type CacheStorage interface {
	EntryStore

	Get(ctx context.Context, key string) ([]byte, error)
	Set(ctx context.Context, key string, value []byte) error
	Close()
}

func NewInMemoryStorage

func NewInMemoryStorage() CacheStorage

type Entry

type Entry struct {
	VariationID     string            `json:"i"`
	Value           interface{}       `json:"v"`
	Type            int               `json:"t"`
	RolloutRules    []*RolloutRule    `json:"r"`
	PercentageRules []*PercentageRule `json:"p"`
}

type EntryStore

type EntryStore interface {
	LoadEntry() *EntryWithEtag
	ComposeBytes() []byte
	StoreEntry(data []byte, fetchTime time.Time, eTag string)
}

func NewEntryStore

func NewEntryStore() EntryStore

type EntryWithEtag

type EntryWithEtag struct {
	ConfigJson    []byte
	CachedETag    string
	FetchTime     time.Time
	GeneratedETag string
}

type Notifier

type Notifier interface {
	Close()
	Closed() <-chan struct{}
	Notify()
	Modified() <-chan struct{}
}

func NewNotifier

func NewNotifier() Notifier

type NotifyingStorage

type NotifyingStorage interface {
	CacheStorage
	Notifier
}

type PercentageRule

type PercentageRule struct {
	VariationID string      `json:"i"`
	Value       interface{} `json:"v"`
	Percentage  int64       `json:"p"`
}

type Preferences

type Preferences struct {
	URL      string `json:"u"`
	Redirect int    `json:"r"`
}

type RolloutRule

type RolloutRule struct {
	VariationID         string      `json:"i"`
	Value               interface{} `json:"v"`
	ComparisonAttribute string      `json:"a"`
	ComparisonValue     string      `json:"c"`
	Comparator          int         `json:"t"`
}

type RootNode

type RootNode struct {
	Entries     map[string]*Entry `json:"f"`
	Preferences *Preferences      `json:"p,omitempty"`
}

func (*RootNode) Fixup

func (r *RootNode) Fixup()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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