Documentation ¶
Overview ¶
store contains an interface for accumulating and accessing vanflow record state, as well as an in memory cache implementation that stores records in a synchronized map.
Index ¶
- Constants
- func WithIfMatch(ctx context.Context, etag string) context.Context
- type CacheConfig
- type CacheIndexer
- type DispatchRegistry
- type Dispatcher
- type Entry
- type EventHandlerFuncs
- type Interface
- type KeyFunc
- type Metadata
- type Ordering
- type RecordAccumulator
- type Selector
- type Set
- type Single
- type SourceRef
Constants ¶
const ( IndexBySource = "source" IndexBySite = "site" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheConfig ¶
type CacheConfig struct { Key KeyFunc Indexers map[string]CacheIndexer EventHandlers EventHandlerFuncs }
type CacheIndexer ¶
CacheIndexer returns a list of index buckets that an entry belongs to. For example, a "IndexBySite" index might have a Link entry that belongs to the bucket for the two sites it connects.
type DispatchRegistry ¶
type DispatchRegistry struct {
// contains filtered or unexported fields
}
DispatchRegistry serves as a registry where store implementations are registered by record type. Used to create a dispatcher for each event source so that updates can be dispatched to the appropriate store.
func (DispatchRegistry) NewDispatcher ¶
func (d DispatchRegistry) NewDispatcher(source SourceRef) Dispatcher
NewDispatcher creates a new dispatcher for that source
func (*DispatchRegistry) RegisterStore ¶
func (d *DispatchRegistry) RegisterStore(record vanflow.Record, stor Interface)
RegisterStore includes a store for the given record type in the registry. Subsequent Dispatchers will route records matching that record type to this store.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher provides the means to dispatch Records from a given RecordMessage to multiple configured stores based on the record's type.
func (Dispatcher) Dispatch ¶
func (d Dispatcher) Dispatch(msg vanflow.RecordMessage)
Dispatch each record in the message to the configured store.
type Entry ¶
Entry is the unit of storage in the store. It wraps a Record with additional context about that record that may not be a part of the record itself.
type EventHandlerFuncs ¶
type Interface ¶
type Interface interface { RecordAccumulator Get(ctx context.Context, obj Entry) (Single, error) Add(ctx context.Context, obj Entry) error Update(ctx context.Context, obj Entry) error Delete(ctx context.Context, obj Entry) error List(ctx context.Context, opts *Selector) (Set, error) Index(ctx context.Context, idx string, obj Entry, opts *Selector) (Set, error) IndexValues(ctx context.Context, idx string) ([]string, error) Replace(context.Context, []Entry) error }
Interface (externally store.Interface) descibes the methods for interracting with a store
func NewDefaultCachingStore ¶
func NewDefaultCachingStore(cfg CacheConfig) Interface
type Metadata ¶
type Metadata struct { // Source of the Entry Source SourceRef // UpdatedAt last time the entry was updated UpdatedAt time.Time // Annotations that describe the entry Annotations map[string]string }
Metadata about a Entry