ebuffer

package
v0.0.0-...-51c274e Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventTSExpiringSegment

func NewEventTSExpiringSegment(capacity int) *eventTSExpiringSegment

func SetLog

func SetLog(log *logging.Logger, trace bool)

Types

type EventTsExpiringBuffer

type EventTsExpiringBuffer struct {
	ExpiringBuffer
}

func NewEventTsExpiringBuffer

func NewEventTsExpiringBuffer(id string, segDurationSec, retentionPeriodSec int) *EventTsExpiringBuffer

func (*EventTsExpiringBuffer) CountAll

func (buf *EventTsExpiringBuffer) CountAll() (int, uint64)

func (*EventTsExpiringBuffer) RecordTS

func (buf *EventTsExpiringBuffer) RecordTS()

type EventTsWithDataExpiringBuffer

type EventTsWithDataExpiringBuffer struct {
	ExpiringBuffer
}

func NewEventTsWithDataExpiringBuffer

func NewEventTsWithDataExpiringBuffer(id string, segDurationSec, retentionPeriodSec int) *EventTsWithDataExpiringBuffer

func (*EventTsWithDataExpiringBuffer) ForEachEntry

func (buf *EventTsWithDataExpiringBuffer) ForEachEntry(callback func(ts uint64, data interface{}) bool, earliest uint64, lock bool) uint64

func (*EventTsWithDataExpiringBuffer) RecordTS

func (buf *EventTsWithDataExpiringBuffer) RecordTS(data interface{})

type EventTsWithIntExpiringBuffer

type EventTsWithIntExpiringBuffer struct {
	ExpiringBuffer
}

func NewEventTsWithIntExpiringBuffer

func NewEventTsWithIntExpiringBuffer(id string, segDurationSec, retentionPeriodSec int) *EventTsWithIntExpiringBuffer

func (*EventTsWithIntExpiringBuffer) ForEachEntry

func (buf *EventTsWithIntExpiringBuffer) ForEachEntry(callback func(ts uint64, num int) bool, earliest uint64, lock bool) uint64

func (*EventTsWithIntExpiringBuffer) RecordInt

func (buf *EventTsWithIntExpiringBuffer) RecordInt(num int)

func (*EventTsWithIntExpiringBuffer) ToFloat64

func (buf *EventTsWithIntExpiringBuffer) ToFloat64(msecAgo uint64) ([]float64, uint64)

type ExpiringBuffer

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

func NewExpiringBuffer

func NewExpiringBuffer(id string, segDurationSec, retentionPeriodSec int, constructor func(prev ExpiringSegment) ExpiringSegment) *ExpiringBuffer

Thread safe through the lock of the whole buffer

func (*ExpiringBuffer) ForEachSegment__

func (buf *ExpiringBuffer) ForEachSegment__(callback func(seg ExpiringSegment) bool)

func (*ExpiringBuffer) GetID

func (buf *ExpiringBuffer) GetID() string

func (*ExpiringBuffer) Lock

func (buf *ExpiringBuffer) Lock()

func (*ExpiringBuffer) NewEntry

func (buf *ExpiringBuffer) NewEntry(data ...interface{})

------------------ NOT THREAD SAFE

func (*ExpiringBuffer) Size

func (buf *ExpiringBuffer) Size() (int, int)

func (*ExpiringBuffer) Unlock

func (buf *ExpiringBuffer) Unlock()

type ExpiringSegment

type ExpiringSegment interface {
	IsExpired(retentionPeriodMs uint64) bool
	IsOpen(segDurationMs uint64) bool
	GetPrev() ExpiringSegment
	SetPrev(ExpiringSegment)
	Put(data ...interface{})
	Touch()
	Size() int
}

--------------------------------------------

type ExpiringSegmentBase

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

---------------------------------

func NewExpiringSegmentBase

func NewExpiringSegmentBase() *ExpiringSegmentBase

func (*ExpiringSegmentBase) GetPrev

func (seg *ExpiringSegmentBase) GetPrev() ExpiringSegment

func (*ExpiringSegmentBase) IsExpired

func (seg *ExpiringSegmentBase) IsExpired(retentionPeriodMs uint64) bool

func (*ExpiringSegmentBase) IsOpen

func (seg *ExpiringSegmentBase) IsOpen(segDurationMs uint64) bool

func (*ExpiringSegmentBase) IsOpen_

func (seg *ExpiringSegmentBase) IsOpen_(segDurationMs uint64) bool

func (*ExpiringSegmentBase) SetPrev

func (seg *ExpiringSegmentBase) SetPrev(prev ExpiringSegment)

func (*ExpiringSegmentBase) Touch

func (seg *ExpiringSegmentBase) Touch()

Jump to

Keyboard shortcuts

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