Documentation ¶
Index ¶
- Constants
- func EventIDsToFixedKeys(eventIDs []EventID) (keys [][]byte)
- type BaseEventData
- func (self *BaseEventData) Data() []byte
- func (self *BaseEventData) EventID() (eventID EventID)
- func (self *BaseEventData) FullEventHeader() FullEventHeader
- func (self *BaseEventData) ObjectHeader() ObjectHeader
- func (self *BaseEventData) SetEventID(eventID EventID)
- func (self *BaseEventData) SetObjectHeader(objectHeader ObjectHeader)
- func (self *BaseEventData) SetTopicID(topicID TopicID)
- func (self *BaseEventData) TopicID() (topicID TopicID)
- type BaseEventDataRing
- func (self *BaseEventDataRing) At() *BaseEventData
- func (self *BaseEventDataRing) Cnt() uint64
- func (self *BaseEventDataRing) Empty() bool
- func (self *BaseEventDataRing) Free() uint64
- func (self *BaseEventDataRing) Get(ed *BaseEventData) (hasEvent bool)
- func (self *BaseEventDataRing) IncReadPos(cnt uint64)
- func (self *BaseEventDataRing) Offer(data BaseEventData) (isIn bool)
- func (self *BaseEventDataRing) Pop(ed *BaseEventData) (hasEvent bool)
- func (self *BaseEventDataRing) Reset()
- type Event
- type EventID
- func (self *EventID) AddTimeUsec(val uint64)
- func (self *EventID) Atomic(tid *uint64) uint64
- func (self *EventID) AtomicAddTimeUsec(val uint64)
- func (self *EventID) AtomicSet(val uint64)
- func (self *EventID) AtomicSetSeq(val uint64)
- func (self *EventID) AtomicSetTimeUsec(val uint64)
- func (self *EventID) FromSlice(data []byte)
- func (self *EventID) Next(timeMicros uint64)
- func (self *EventID) Seq() uint64
- func (self *EventID) SetSeq(val uint64)
- func (self *EventID) SetSeqNext()
- func (self *EventID) SetTimeUsec(val uint64)
- func (self *EventID) SetTimeUsecMax()
- func (self *EventID) String() string
- func (self EventID) TimeUsec() uint64
- type EventIDKey
- type FlatEventValue
- type FlatEventValueBuffer
- type FnBaseEventDataToTopicEvent
- type FnDataToTopicEvent
- type FnDataToTopicEvents
- type FullDataTopicEvent
- type FullEventHeader
- type FullEventHeaderKey
- type FullEventValue
- type FullEventValueBuffer
- type ObjectHeader
- type TopicEvent
- type TopicEventData
- type TopicEventEventKey
- func (self *TopicEventEventKey) AsSlice() (data []byte)
- func (self *TopicEventEventKey) FromSlice(data []byte)
- func (self *TopicEventEventKey) Marshal() (data []byte, err error)
- func (self *TopicEventEventKey) MarshalTo(data []byte) (err error)
- func (self *TopicEventEventKey) Size() int
- func (self *TopicEventEventKey) Slice() (data []byte)
- func (self *TopicEventEventKey) Unmarshal(data []byte) (err error)
- type TopicEventHeader
- type TopicID
- func (self *TopicID) AsSlice() []byte
- func (self *TopicID) Atomic() TopicID
- func (self *TopicID) AtomicNext() (cur, next TopicID)
- func (self *TopicID) AtomicSet(val TopicID)
- func (self *TopicID) AtomicSetSeq(val uint64)
- func (self *TopicID) ContextSubType() uint64
- func (self *TopicID) ContextType() uint64
- func (self *TopicID) FromSlice(data []byte)
- func (self *TopicID) Next()
- func (self *TopicID) Seq() uint64
- func (self *TopicID) SetContextSubType(val uint64)
- func (self *TopicID) SetContextType(val uint64)
- func (self *TopicID) SetSeq(val uint64)
- func (self *TopicID) SetSeqNext()
- func (self *TopicID) String() string
Constants ¶
const EventIDByteSz = 8
const EventIDMax = EventID(math.MaxUint64)
const FlatEventValueBaseByteSz = ObjectHeaderByteSz
const FullEventHeaderByteSz = ObjectHeaderByteSz + TopicEventHeaderByteSz
const ObjectHeaderByteSz = 8
const TopicEventEventKeyByteSz = 16
const TopicEventHeaderByteSz = TopicIDByteSz + EventIDByteSz
const TopicIDByteSz = 8
const TopicIDMax = TopicID(math.MaxInt64)
Variables ¶
This section is empty.
Functions ¶
func EventIDsToFixedKeys ¶
Types ¶
type BaseEventData ¶
type BaseEventData struct {
// contains filtered or unexported fields
}
BaseEventData holds a FullEventHeader and the events data separately.
func BaseEventDataCreate ¶
func BaseEventDataCreate(topicID TopicID, eventID EventID, objectHeader ObjectHeader, data []byte) (self BaseEventData)
func (*BaseEventData) Data ¶
func (self *BaseEventData) Data() []byte
func (*BaseEventData) EventID ¶
func (self *BaseEventData) EventID() (eventID EventID)
func (*BaseEventData) FullEventHeader ¶
func (self *BaseEventData) FullEventHeader() FullEventHeader
func (*BaseEventData) ObjectHeader ¶
func (self *BaseEventData) ObjectHeader() ObjectHeader
func (*BaseEventData) SetEventID ¶
func (self *BaseEventData) SetEventID(eventID EventID)
func (*BaseEventData) SetObjectHeader ¶
func (self *BaseEventData) SetObjectHeader(objectHeader ObjectHeader)
func (*BaseEventData) SetTopicID ¶
func (self *BaseEventData) SetTopicID(topicID TopicID)
func (*BaseEventData) TopicID ¶
func (self *BaseEventData) TopicID() (topicID TopicID)
type BaseEventDataRing ¶
type BaseEventDataRing struct {
// contains filtered or unexported fields
}
BaseEventDataRing is a ring of EventData
func BaseEventDataRingCreate ¶
func BaseEventDataRingCreate(cap int) (self BaseEventDataRing)
func (*BaseEventDataRing) At ¶
func (self *BaseEventDataRing) At() *BaseEventData
func (*BaseEventDataRing) Cnt ¶
func (self *BaseEventDataRing) Cnt() uint64
Cnt returns the cnt of the elements in the ring.
func (*BaseEventDataRing) Empty ¶
func (self *BaseEventDataRing) Empty() bool
Empty returns whether the ring is empty.
func (*BaseEventDataRing) Free ¶
func (self *BaseEventDataRing) Free() uint64
Free returns the freespace in the ring.
func (*BaseEventDataRing) Get ¶
func (self *BaseEventDataRing) Get(ed *BaseEventData) (hasEvent bool)
Get returns the element at the current readPos if self.Empty() == false
func (*BaseEventDataRing) IncReadPos ¶
func (self *BaseEventDataRing) IncReadPos(cnt uint64)
IncReadPos pops cnt events. (adds cnt to self.readPos) panics if self.Cnt() < cnt
func (*BaseEventDataRing) Offer ¶
func (self *BaseEventDataRing) Offer(data BaseEventData) (isIn bool)
Offer puts data in the ring at current writePos if self.Free() > 0 and increses the writePos.
func (*BaseEventDataRing) Pop ¶
func (self *BaseEventDataRing) Pop(ed *BaseEventData) (hasEvent bool)
Pop returns the element at the current readPos if self.Empty() == false and increases the readPos.
func (*BaseEventDataRing) Reset ¶
func (self *BaseEventDataRing) Reset()
Reset sets writePos and readPos to zero and sets all element of its datas to nil.
type EventID ¶
type EventID uint64
EventID is used to identify a unique event of a topic.
func EventIDFromBuf ¶
func (*EventID) AddTimeUsec ¶
func (*EventID) AtomicAddTimeUsec ¶
func (*EventID) AtomicSetSeq ¶
func (*EventID) AtomicSetTimeUsec ¶
func (*EventID) SetSeqNext ¶
func (self *EventID) SetSeqNext()
func (*EventID) SetTimeUsec ¶
func (*EventID) SetTimeUsecMax ¶
func (self *EventID) SetTimeUsecMax()
type EventIDKey ¶
type EventIDKey [EventIDByteSz]byte
func EventIDKeyFromEventID ¶
func EventIDKeyFromEventID(eid EventID) (eik EventIDKey)
func (*EventIDKey) EventID ¶
func (self *EventIDKey) EventID() EventID
func (*EventIDKey) SetEventID ¶
func (self *EventIDKey) SetEventID(eid EventID)
type FlatEventValue ¶
type FlatEventValue []byte
FlatEventValue holds a single event prefixed by its ObjectHeader. It can be used to send and receive a single event
func FlatEventValueCreate ¶
func FlatEventValueCreate(cap uint64) FlatEventValue
FlatEventValueCreate returns a new FlatEventValue with the byte capacity of ObjectHeaderByteSz + cap.
func FlatEventValueFromSlice ¶
func FlatEventValueFromSlice(data []byte) FlatEventValue
func FlatEventValueFromSliceWithPrefix ¶
func FlatEventValueFromSliceWithPrefix(data []byte, dataPrefixSize uint64) FlatEventValue
FlatEventValueFromSliceWithPrefix can be used to create a larger object header dataPrefixSize must be calculated without ObjectHeaderByteSz ObjectHeader.ExtensionByteSize must reflect dataPrefixSize
func (FlatEventValue) CopyData ¶
func (self FlatEventValue) CopyData(src []byte)
CopyData just copies data to the Data() of this FlatEventValue, thats all
func (FlatEventValue) Data ¶
func (self FlatEventValue) Data() []byte
Data returns the data without ObjectHeader.
func (FlatEventValue) ObjectHeader ¶
func (self FlatEventValue) ObjectHeader() ObjectHeader
func (FlatEventValue) SetObjectHeader ¶
func (self FlatEventValue) SetObjectHeader(eh ObjectHeader)
type FlatEventValueBuffer ¶
type FlatEventValueBuffer struct {
FixedPrefixSizeBuffer
}
func FlatEventValueBufferCreate ¶
func FlatEventValueBufferCreate(cnt uint64) FlatEventValueBuffer
type FnBaseEventDataToTopicEvent ¶
type FnBaseEventDataToTopicEvent func(bed *BaseEventData) (te TopicEvent)
type FnDataToTopicEvent ¶
type FnDataToTopicEvent func(data []byte) (te TopicEvent)
type FnDataToTopicEvents ¶
type FnDataToTopicEvents func(data []byte) (tes []TopicEvent)
type FullDataTopicEvent ¶
type FullDataTopicEvent interface { TopicEvent Data() []byte }
type FullEventHeader ¶
type FullEventHeader struct { ObjectHeader ObjectHeader TopicEventHeader TopicEventHeader }
FullEventHeader. The order of fields matters here, for example to change from Flat- to FullEventValue.
type FullEventHeaderKey ¶
type FullEventHeaderKey [FullEventHeaderByteSz]byte
func FullEventHeaderToKey ¶
func FullEventHeaderToKey(teh FullEventHeader) FullEventHeaderKey
func (*FullEventHeaderKey) ObjectHeader ¶
func (self *FullEventHeaderKey) ObjectHeader() ObjectHeader
func (*FullEventHeaderKey) SetObjectHeader ¶
func (self *FullEventHeaderKey) SetObjectHeader(oh ObjectHeader)
func (*FullEventHeaderKey) SetTopicEventHeader ¶
func (self *FullEventHeaderKey) SetTopicEventHeader(tid TopicEventHeader)
func (*FullEventHeaderKey) TopicEventHeader ¶
func (self *FullEventHeaderKey) TopicEventHeader() TopicEventHeader
type FullEventValue ¶
type FullEventValue []byte
FlatEventValue holds a single event prefixed by its FullEventHeader. It can be used to send and receive a single event
func FullEventValueByFlatEventValue ¶
func FullEventValueByFlatEventValue(fev FlatEventValue) FullEventValue
func FullEventValueCreate ¶
func FullEventValueCreate(cap uint64) FullEventValue
func FullEventValueFromBaseEventData ¶
func FullEventValueFromBaseEventData(bed *BaseEventData) FullEventValue
func FullEventValueFromSlice ¶
func FullEventValueFromSlice(data []byte) FullEventValue
func (FullEventValue) Data ¶
func (self FullEventValue) Data() []byte
func (FullEventValue) FullEventHeader ¶
func (self FullEventValue) FullEventHeader() FullEventHeader
func (FullEventValue) SetFullEventHeader ¶
func (self FullEventValue) SetFullEventHeader(eh FullEventHeader)
type FullEventValueBuffer ¶
type FullEventValueBuffer struct {
FixedPrefixSizeBuffer
}
func FullEventValueBufferCreateFixed ¶
func FullEventValueBufferCreateFixed(cnt uint64) FullEventValueBuffer
func FullEventValueBufferCreateFixedWithValueSize ¶
func FullEventValueBufferCreateFixedWithValueSize(valueSize, cnt uint64) FullEventValueBuffer
valueSize is the size of the values
type ObjectHeader ¶
type ObjectHeader struct { ObjectDataType uint16 UnderlyingDataType uint16 Format uint8 Format2 uint8 // ExtensionByteSize defines the bytes after this header // which belong to an implementation specific header ExtensionByteSize uint16 }
ObjectHeader holds description of the type of an object or event.
func ObjectHeaderFromUint64 ¶
func ObjectHeaderFromUint64(val uint64) ObjectHeader
type TopicEvent ¶
type TopicEvent interface { Event TopicID() TopicID CopyTo(other TopicEvent) }
type TopicEventData ¶
type TopicEventData interface { TopicID() TopicID EventID() EventID ObjectHeader() ObjectHeader Data() []byte }
type TopicEventEventKey ¶
TopicEventEventKey defines a 16 byte unique event identification. first 8 byte is TopicID, second 8 byte is EventID
func TopicEventEventKeyMax ¶
func TopicEventEventKeyMax(topicID TopicID) (self TopicEventEventKey)
TopicEventEventKeyMax return a TopicEventEventKey for topicID with a maximum EventID.
func (*TopicEventEventKey) AsSlice ¶
func (self *TopicEventEventKey) AsSlice() (data []byte)
AsSlice returns the TopicEventEventKey as a byte slice but unsafe!
func (*TopicEventEventKey) FromSlice ¶
func (self *TopicEventEventKey) FromSlice(data []byte)
FromSlice copies the data from data to TopicEventEventKey.
func (*TopicEventEventKey) Marshal ¶
func (self *TopicEventEventKey) Marshal() (data []byte, err error)
Marshal implements the marshaler interface.
func (*TopicEventEventKey) MarshalTo ¶
func (self *TopicEventEventKey) MarshalTo(data []byte) (err error)
MarshalTo implements the marshaler interface.
func (*TopicEventEventKey) Size ¶
func (self *TopicEventEventKey) Size() int
Size implements the marshaler interface.
func (*TopicEventEventKey) Slice ¶
func (self *TopicEventEventKey) Slice() (data []byte)
Slice returns the TopicEventEventKey as a freshly allocated byte slice.
func (*TopicEventEventKey) Unmarshal ¶
func (self *TopicEventEventKey) Unmarshal(data []byte) (err error)
Unmarshal implements the unmarshaler interface.
type TopicEventHeader ¶
TopicEventHeader holds the TopicID and the EventID of an event.
func TopicEventHeaderFromBuf ¶
func TopicEventHeaderFromBuf(data []byte) TopicEventHeader
func (*TopicEventHeader) AsSlice ¶
func (self *TopicEventHeader) AsSlice() []byte
func (*TopicEventHeader) Slice ¶
func (self *TopicEventHeader) Slice() []byte
type TopicID ¶
type TopicID uint64
TopicID is used to identify a unique topic. It contains a ContextType(), Time() in ms and a sequence Seq()
func TopicIDCreate ¶
func (*TopicID) AtomicNext ¶
func (*TopicID) AtomicSetSeq ¶
func (*TopicID) ContextSubType ¶
func (*TopicID) ContextType ¶
func (*TopicID) SetContextSubType ¶
func (*TopicID) SetContextType ¶
func (*TopicID) SetSeqNext ¶
func (self *TopicID) SetSeqNext()