counters

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CncFile                 = "cnc.dat"
	CurrentCncVersion int32 = 512 // util.SemanticVersionCompose(0, 2, 0)
)
View Source
const COUNTER_LENGTH = util.CacheLineLength * 2
View Source
const FULL_LABEL_LENGTH = util.CacheLineLength * 6
View Source
const KEY_OFFSET = 16
View Source
const LABEL_OFFSET = util.CacheLineLength * 2
View Source
const MAX_KEY_LENGTH = (util.CacheLineLength * 2) - (util.SizeOfInt32 * 2) - util.SizeOfInt64
View Source
const METADATA_LENGTH = LABEL_OFFSET + FULL_LABEL_LENGTH
View Source
const NullCounterId = int32(-1)
View Source
const RECORD_ALLOCATED int32 = 1
View Source
const RECORD_RECLAIMED int32 = -1
View Source
const RECORD_UNUSED int32 = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Id     int32
	TypeId int32
	Value  int64
	Label  string
}

type MetaDataFlyweight

type MetaDataFlyweight struct {
	flyweight.FWBase

	CncVersion flyweight.Int32Field

	ToDriverBufLen flyweight.Int32Field
	ToClientBufLen flyweight.Int32Field

	ClientLivenessTo     flyweight.Int64Field
	DriverStartTimestamp flyweight.Int64Field
	DriverPid            flyweight.Int64Field

	ToDriverBuf  flyweight.RawDataField
	ToClientsBuf flyweight.RawDataField
	MetaDataBuf  flyweight.RawDataField
	ValuesBuf    flyweight.RawDataField
	ErrorBuf     flyweight.RawDataField
	// contains filtered or unexported fields
}

*

  • Description of the command and control file used between driver and clients.
  • <p>
  • File Layout
  • <pre>
  • +-----------------------------+
  • | Meta Data |
  • +-----------------------------+
  • | to-driver Buffer |
  • +-----------------------------+
  • | to-clients Buffer |
  • +-----------------------------+
  • | Counters Metadata Buffer |
  • +-----------------------------+
  • | Counters Values Buffer |
  • +-----------------------------+
  • | Error Log |
  • +-----------------------------+
  • </pre>
  • <p>
  • Meta Data Layout (CnC Version 0.2.0 => 512)
  • <pre>
  • 0 1 2 3
  • 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  • +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • | Aeron CnC Version |
  • +---------------------------------------------------------------+
  • | to-driver buffer length |
  • +---------------------------------------------------------------+
  • | to-clients buffer length |
  • +---------------------------------------------------------------+
  • | Counters Metadata buffer length |
  • +---------------------------------------------------------------+
  • | Counters Values buffer length |
  • +---------------------------------------------------------------+
  • | Error Log buffer length |
  • +---------------------------------------------------------------+
  • | Client Liveness Timeout |
  • | |
  • +---------------------------------------------------------------+
  • | Driver Start Timestamp |
  • | |
  • +---------------------------------------------------------------+
  • | Driver PID |
  • | |
  • +---------------------------------------------------------------+
  • </pre> *
  • See also <a href="https://github.com/real-logic/aeron/blob/master/aeron-client/src/main/cpp/CncFileDescriptor.h">CncFileDescriptor.h</a>.

func MapFile

func MapFile(filename string) (*MetaDataFlyweight, *memmap.File, error)

func (*MetaDataFlyweight) Wrap

func (m *MetaDataFlyweight) Wrap(buf *atomic.Buffer, offset int) flyweight.Flyweight

type ReadableCounter added in v1.0.5

type ReadableCounter struct {
	Reader    *Reader
	CounterId int32
	// contains filtered or unexported fields
}

func NewReadableCounter added in v1.0.5

func NewReadableCounter(reader *Reader, counterId int32) (*ReadableCounter, error)

func (*ReadableCounter) Get added in v1.0.5

func (rc *ReadableCounter) Get() int64

func (*ReadableCounter) GetWeak added in v1.0.5

func (rc *ReadableCounter) GetWeak() int64

func (*ReadableCounter) Label added in v1.0.5

func (rc *ReadableCounter) Label() string

func (*ReadableCounter) State added in v1.0.5

func (rc *ReadableCounter) State() int32

type Reader

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

func NewReader

func NewReader(values, metaData *atomic.Buffer) *Reader

func (*Reader) FindCounter added in v1.0.8

func (reader *Reader) FindCounter(typeId int32, keyFilter func(keyBuffer *atomic.Buffer) bool) int32

func (*Reader) GetKeyPartInt32

func (reader *Reader) GetKeyPartInt32(counterId int32, offset int32) (int32, error)

GetKeyPartInt32 returns an int32 portion of the key at the specified offset

func (*Reader) GetKeyPartInt64 added in v1.0.5

func (reader *Reader) GetKeyPartInt64(counterId int32, offset int32) (int64, error)

GetKeyPartInt64 returns an int64 portion of the key at the specified offset

func (*Reader) Scan

func (reader *Reader) Scan(cb func(Counter))

Jump to

Keyboard shortcuts

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