store

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MIN_INT64 = int64(^uint64(0) >> 1)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpirationHeap

type ExpirationHeap []storageExpiration

func (ExpirationHeap) Len

func (h ExpirationHeap) Len() int

func (ExpirationHeap) Less

func (h ExpirationHeap) Less(i, j int) bool

func (*ExpirationHeap) Pop

func (h *ExpirationHeap) Pop() interface{}

func (*ExpirationHeap) Push

func (h *ExpirationHeap) Push(x interface{})

func (ExpirationHeap) Swap

func (h ExpirationHeap) Swap(i, j int)

type Memory

type Memory interface {
	// Memory returns in-use heap memory and total system memory.
	Memory() (heap, avail, total uint64)
}

Memory is used to give information about system memory.

type MemoryConsultant

type MemoryConsultant interface {
	// Prune returns the number of envelopes to prune.
	GetQuantityToPrune(int64) int
	// setMemoryReporter accepts a reporting function for Memory Utilization
	SetMemoryReporter(func(float64))
}

MemoryConsultant is used to determine if the store should prune.

type Metrics

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

type MetricsInitializer

type MetricsInitializer interface {
	NewCounter(name string) func(delta uint64)
	NewGauge(name, unit string) func(value float64)
}

type PruneConsultant

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

PruneConsultant keeps track of the available memory on the system and tries to utilize as much memory as possible while not being a bad neighbor.

func NewPruneConsultant

func NewPruneConsultant(stepBy int, percentToFill float64, m Memory) *PruneConsultant

NewPruneConsultant returns a new PruneConsultant.

func (*PruneConsultant) GetQuantityToPrune

func (pc *PruneConsultant) GetQuantityToPrune(storeCount int64) int

Prune reports how many entries should be removed.

func (*PruneConsultant) SetMemoryReporter

func (pc *PruneConsultant) SetMemoryReporter(mr func(float64))

type Store

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

Store is an in-memory data store for envelopes. It will store envelopes up to a per-source threshold and evict oldest data first, as instructed by the Pruner. All functions are thread safe.

func NewStore

func NewStore(maxPerSource int, mc MemoryConsultant, m MetricsInitializer) *Store

func (*Store) BuildExpirationHeap

func (store *Store) BuildExpirationHeap() *ExpirationHeap

func (*Store) Get

func (store *Store) Get(
	index string,
	start time.Time,
	end time.Time,
	envelopeTypes []logcache_v1.EnvelopeType,
	nameFilter *regexp.Regexp,
	limit int,
	descending bool,
) []*loggregator_v2.Envelope

Get fetches envelopes from the store based on the source ID, start and end time. Start is inclusive while end is not: [start..end).

func (*Store) Meta

func (store *Store) Meta() map[string]logcache_v1.MetaInfo

Meta returns each source ID tracked in the store.

func (*Store) Put

func (store *Store) Put(envelope *loggregator_v2.Envelope, sourceId string)

func (*Store) WaitForTruncationToComplete

func (store *Store) WaitForTruncationToComplete() bool

Jump to

Keyboard shortcuts

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