Documentation ¶
Index ¶
- Constants
- func SortKeySpanIDs(keyspanIDs []model.KeySpanID)
- type KeySpanRecord
- type KeySpanSet
- func (s *KeySpanSet) AddKeySpanRecord(record *KeySpanRecord) (successful bool)
- func (s *KeySpanSet) CountKeySpanByCaptureID(captureID model.CaptureID) int
- func (s *KeySpanSet) CountKeySpanByStatus(status KeySpanStatus) (count int)
- func (s *KeySpanSet) GetAllKeySpans() map[model.KeySpanID]*KeySpanRecord
- func (s *KeySpanSet) GetAllKeySpansGroupedByCaptures() map[model.CaptureID]map[model.KeySpanID]*KeySpanRecord
- func (s *KeySpanSet) GetDistinctCaptures() []model.CaptureID
- func (s *KeySpanSet) GetKeySpanRecord(keyspanID model.KeySpanID) (*KeySpanRecord, bool)
- func (s *KeySpanSet) RemoveKeySpanRecord(keyspanID model.KeySpanID) bool
- func (s *KeySpanSet) RemoveKeySpanRecordByCaptureID(captureID model.CaptureID) []*KeySpanRecord
- func (s *KeySpanSet) UpdateKeySpanRecord(record *KeySpanRecord) (successful bool)
- type KeySpanStatus
Constants ¶
const ( AddingKeySpan = KeySpanStatus(iota) + 1 RemovingKeySpan RunningKeySpan )
Variables ¶
This section is empty.
Functions ¶
func SortKeySpanIDs ¶
SortKeySpanIDs sorts a slice of keyspan IDs in ascending order.
Types ¶
type KeySpanRecord ¶
type KeySpanRecord struct { KeySpanID model.KeySpanID CaptureID model.CaptureID Status KeySpanStatus }
keyspanRecord is a record to be inserted into keyspanSet.
func (*KeySpanRecord) Clone ¶
func (r *KeySpanRecord) Clone() *KeySpanRecord
Clone returns a copy of the KeySpanSet. This method is future-proof in case we add something not trivially copyable.
type KeySpanSet ¶
type KeySpanSet struct {
// contains filtered or unexported fields
}
KeySpanSet provides a data structure to store the keyspans' states for the scheduler.
func (*KeySpanSet) AddKeySpanRecord ¶
func (s *KeySpanSet) AddKeySpanRecord(record *KeySpanRecord) (successful bool)
AddKeySpanRecord inserts a new KeySpanRecord. It returns true if it succeeds. Returns false if there is a duplicate.
func (*KeySpanSet) CountKeySpanByCaptureID ¶
func (s *KeySpanSet) CountKeySpanByCaptureID(captureID model.CaptureID) int
CountKeySpanByCaptureID counts the number of keyspans associated with the captureID.
func (*KeySpanSet) CountKeySpanByStatus ¶
func (s *KeySpanSet) CountKeySpanByStatus(status KeySpanStatus) (count int)
CountKeySpanByStatus counts the number of keyspans with the given status.
func (*KeySpanSet) GetAllKeySpans ¶
func (s *KeySpanSet) GetAllKeySpans() map[model.KeySpanID]*KeySpanRecord
GetAllKeySpans returns all stored information on all keyspans.
func (*KeySpanSet) GetAllKeySpansGroupedByCaptures ¶
func (s *KeySpanSet) GetAllKeySpansGroupedByCaptures() map[model.CaptureID]map[model.KeySpanID]*KeySpanRecord
GetAllKeySpansGroupedByCaptures returns all stored information grouped by associated CaptureID.
func (*KeySpanSet) GetDistinctCaptures ¶
func (s *KeySpanSet) GetDistinctCaptures() []model.CaptureID
GetDistinctCaptures counts distinct captures with keyspans.
func (*KeySpanSet) GetKeySpanRecord ¶
func (s *KeySpanSet) GetKeySpanRecord(keyspanID model.KeySpanID) (*KeySpanRecord, bool)
GetKeySpanRecord tries to obtain a record with the specified keyspanID.
func (*KeySpanSet) RemoveKeySpanRecord ¶
func (s *KeySpanSet) RemoveKeySpanRecord(keyspanID model.KeySpanID) bool
RemoveKeySpanRecord removes the record with keyspanID. Returns false if none exists.
func (*KeySpanSet) RemoveKeySpanRecordByCaptureID ¶
func (s *KeySpanSet) RemoveKeySpanRecordByCaptureID(captureID model.CaptureID) []*KeySpanRecord
RemoveKeySpanRecordByCaptureID removes all keyspan records associated with captureID.
func (*KeySpanSet) UpdateKeySpanRecord ¶
func (s *KeySpanSet) UpdateKeySpanRecord(record *KeySpanRecord) (successful bool)
UpdateKeySpanRecord updates an existing KeySpanRecord. All modifications to a keyspan's status should be done by this method.
type KeySpanStatus ¶
type KeySpanStatus int32
KeySpanStatus is a type representing the keyspan's replication status.