Documentation ¶
Index ¶
- Constants
- type AtomicCounter
- type Counter
- type MetaDataFlyweight
- type ReadableCounter
- type Reader
- func (reader *Reader) FindCounter(typeId int32, keyFilter func(keyBuffer *atomic.Buffer) bool) int32
- func (reader *Reader) GetCounterOwnerId(counterId int32) int64
- func (reader *Reader) GetCounterRegistrationId(counterId int32) int64
- func (reader *Reader) GetCounterTypeId(counterId int32) int32
- func (reader *Reader) GetCounterValue(counterId int32) int64
- func (reader *Reader) GetKeyPartInt32(counterId int32, offset int32) (int32, error)
- func (reader *Reader) GetKeyPartInt64(counterId int32, offset int32) (int64, error)
- func (reader *Reader) GetKeyPartString(counterId int32, offset int32) (string, error)
- func (reader *Reader) IsCounterAllocated(counterId int32) bool
- func (reader *Reader) Scan(cb func(Counter))
- func (reader *Reader) ScanForType(typeId int32, callback func(counterId int32, keyBuffer *atomic.Buffer) bool)
Constants ¶
const ( CncFile = "cnc.dat" CurrentCncVersion int32 = 512 // util.SemanticVersionCompose(0, 2, 0) )
const CounterLength = util.CacheLineLength * 2
const FreeForReuseDeadlineOffset = TypeIdOffset + util.SizeOfInt32
FreeForReuseDeadlineOffset is the offset in the record at which the deadline (in milliseconds) for when counter may be reused.
const FullLabelLength = util.CacheLineLength * 6
const KeyOffset = FreeForReuseDeadlineOffset + util.SizeOfInt64
const LabelOffset = util.CacheLineLength * 2
const MaxKeyLength = (util.CacheLineLength * 2) - (util.SizeOfInt32 * 2) - util.SizeOfInt64
const MaxLabelLength = FullLabelLength - util.SizeOfInt32
const MetadataLength = LabelOffset + FullLabelLength
const NullCounterId = int32(-1)
const OwnerIdOffset = RegistrationIdOffset + util.SizeOfInt64
const RecordAllocated int32 = 1
const RecordReclaimed int32 = -1
const RecordUnused int32 = 0
const RegistrationIdOffset = util.SizeOfInt64
const TypeIdOffset = util.SizeOfInt32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicCounter ¶
type AtomicCounter struct { Reader *Reader CounterId int32 // contains filtered or unexported fields }
func NewAtomicCounter ¶
func NewAtomicCounter(reader *Reader, counterId int32) (*AtomicCounter, error)
func (*AtomicCounter) Get ¶
func (ac *AtomicCounter) Get() int64
func (*AtomicCounter) GetWeak ¶
func (ac *AtomicCounter) GetWeak() int64
func (*AtomicCounter) Label ¶
func (ac *AtomicCounter) Label() string
func (*AtomicCounter) Set ¶
func (ac *AtomicCounter) Set(value int64)
func (*AtomicCounter) SetWeak ¶
func (ac *AtomicCounter) SetWeak(value int64)
func (*AtomicCounter) State ¶
func (ac *AtomicCounter) State() int32
type MetaDataFlyweight ¶
type MetaDataFlyweight struct { flyweight.FWBase CncVersion 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 InitAndWrapMetaData ¶
func InitAndWrapMetaData(buf *atomic.Buffer, offset int, toDriverBufLen int32, toClientBufLen int32, metadataBufLen int32, valuesBufLen int32, errorLogLen int32) *MetaDataFlyweight
InitAndWrapMetaData is a test method to inject the desired values into the buffer, then wrap it as a MetaDataFlyweight.
type ReadableCounter ¶
type ReadableCounter struct { Reader *Reader RegistrationId int64 CounterId int32 // contains filtered or unexported fields }
func NewReadableCounter ¶
func NewReadableCounter(reader *Reader, counterId int32) (*ReadableCounter, error)
func NewReadableRegisteredCounter ¶
func NewReadableRegisteredCounter(reader *Reader, registrationId int64, counterId int32) (*ReadableCounter, error)
func (*ReadableCounter) Close ¶
func (rc *ReadableCounter) Close()
func (*ReadableCounter) Get ¶
func (rc *ReadableCounter) Get() int64
func (*ReadableCounter) GetWeak ¶
func (rc *ReadableCounter) GetWeak() int64
func (*ReadableCounter) IsClosed ¶
func (rc *ReadableCounter) IsClosed() bool
func (*ReadableCounter) Label ¶
func (rc *ReadableCounter) Label() string
func (*ReadableCounter) State ¶
func (rc *ReadableCounter) State() int32
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) FindCounter ¶
func (*Reader) GetCounterOwnerId ¶
func (*Reader) GetCounterRegistrationId ¶
func (*Reader) GetCounterTypeId ¶
GetCounterTypeId returns the type id for a counter.
func (*Reader) GetCounterValue ¶
GetCounterValue returns the value of the given counter id (as a volatile read).
func (*Reader) GetKeyPartInt32 ¶
GetKeyPartInt32 returns an int32 portion of the key at the specified offset
func (*Reader) GetKeyPartInt64 ¶
GetKeyPartInt64 returns an int64 portion of the key at the specified offset
func (*Reader) GetKeyPartString ¶
GetKeyPartString returns a string portion of the key, assuming the string is prefixed by its length (as an 32-bit int) at the specified offset.