Documentation ¶
Index ¶
- Constants
- type ExpirationHeap
- type Memory
- type MemoryConsultant
- type Metrics
- type MetricsInitializer
- type PruneConsultant
- type Store
- func (store *Store) BuildExpirationHeap() *ExpirationHeap
- func (store *Store) Get(index string, start time.Time, end time.Time, ...) []*loggregator_v2.Envelope
- func (store *Store) Meta() map[string]logcache_v1.MetaInfo
- func (store *Store) Put(envelope *loggregator_v2.Envelope, sourceId string)
- func (store *Store) WaitForTruncationToComplete() bool
Constants ¶
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 MetricsInitializer ¶
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, 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.