typed

package
v0.0.0-...-81473b2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

README

Tables in Sloop


There are four tables in Sloop to store data:

  1. Watch table
  2. Resources summary table
  3. Event count table
  4. Watch activity table

Details:

  1. Watch table: It has the raw kube watch data. It is the source of truth for the whole data.

  2. Resource Summary: It stores the resources information including name, creation date, deployment details and last update time.

  3. Event table: It stores the event details that took place for a resource. The information includes event type, message and time stamp.

  4. Watch Activity table: It stores any watch activity received. It has the information that was there a change from the last known state or not.

Data Distribution

The data distribution in terms of size among the tables is shown below. As expected, watch table occupies the most space as it contains the raw data. Rest of the tables are derived from it. DataDistribution

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KubeWatchResult_WatchType_name = map[int32]string{
	0: "ADD",
	1: "UPDATE",
	2: "DELETE",
}
View Source
var KubeWatchResult_WatchType_value = map[string]int32{
	"ADD":    0,
	"UPDATE": 1,
	"DELETE": 2,
}

Functions

func KubeWatchResult_KeyPredicateFns

func KubeWatchResult_KeyPredicateFns(keyFn ...func(string) bool) func(string) bool

func KubeWatchResult_ValPredicateFns

func KubeWatchResult_ValPredicateFns(valFn ...func(*KubeWatchResult) bool) func(*KubeWatchResult) bool

func ResourceEventCounts_KeyPredicateFns

func ResourceEventCounts_KeyPredicateFns(keyFn ...func(string) bool) func(string) bool

func ResourceEventCounts_ValPredicateFns

func ResourceEventCounts_ValPredicateFns(valFn ...func(*ResourceEventCounts) bool) func(*ResourceEventCounts) bool

func ResourceSummary_KeyPredicateFns

func ResourceSummary_KeyPredicateFns(keyFn ...func(string) bool) func(string) bool

func ResourceSummary_ValPredicateFns

func ResourceSummary_ValPredicateFns(valFn ...func(*ResourceSummary) bool) func(*ResourceSummary) bool

func StringToProtobufTimestamp

func StringToProtobufTimestamp(ts string) (*timestamp.Timestamp, error)

func ValueType_KeyPredicateFns

func ValueType_KeyPredicateFns(keyFn ...func(string) bool) func(string) bool

func ValueType_ValPredicateFns

func ValueType_ValPredicateFns(valFn ...func(*ValueType) bool) func(*ValueType) bool

func WatchActivity_KeyPredicateFns

func WatchActivity_KeyPredicateFns(keyFn ...func(string) bool) func(string) bool

func WatchActivity_ValPredicateFns

func WatchActivity_ValPredicateFns(valFn ...func(*WatchActivity) bool) func(*WatchActivity) bool

Types

type EventCountKey

type EventCountKey struct {
	PartitionId string
	Kind        string
	Namespace   string
	Name        string
	Uid         string
}

func NewEventCountKey

func NewEventCountKey(timestamp time.Time, kind string, namespace string, name string, uid string) *EventCountKey

func NewEventCountKeyComparator

func NewEventCountKeyComparator(kind string, namespace string, name string, uid string) *EventCountKey

func (*EventCountKey) Parse

func (k *EventCountKey) Parse(key string) error

func (*EventCountKey) SetPartitionId

func (k *EventCountKey) SetPartitionId(newPartitionId string)

func (*EventCountKey) String

func (k *EventCountKey) String() string

todo: need to make sure it can work as keyPrefix when some fields are empty

func (*EventCountKey) TableName

func (*EventCountKey) TableName() string

func (*EventCountKey) ValidateKey

func (*EventCountKey) ValidateKey(key string) error

type EventCounts

type EventCounts struct {
	MapReasonToCount     map[string]int32 `` /* 174-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*EventCounts) Descriptor

func (*EventCounts) Descriptor() ([]byte, []int)

func (*EventCounts) GetMapReasonToCount

func (m *EventCounts) GetMapReasonToCount() map[string]int32

func (*EventCounts) ProtoMessage

func (*EventCounts) ProtoMessage()

func (*EventCounts) Reset

func (m *EventCounts) Reset()

func (*EventCounts) String

func (m *EventCounts) String() string

func (*EventCounts) XXX_DiscardUnknown

func (m *EventCounts) XXX_DiscardUnknown()

func (*EventCounts) XXX_Marshal

func (m *EventCounts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventCounts) XXX_Merge

func (m *EventCounts) XXX_Merge(src proto.Message)

func (*EventCounts) XXX_Size

func (m *EventCounts) XXX_Size() int

func (*EventCounts) XXX_Unmarshal

func (m *EventCounts) XXX_Unmarshal(b []byte) error

type KeyType

type KeyType struct {
	PartitionId string
}

func (*KeyType) GetTestKey

func (*KeyType) GetTestKey() string

func (*KeyType) GetTestValue

func (*KeyType) GetTestValue() *ValueType

func (*KeyType) Parse

func (*KeyType) Parse(key string) error

func (*KeyType) SetPartitionId

func (*KeyType) SetPartitionId(newPartitionId string)

func (*KeyType) SetTestKeys

func (*KeyType) SetTestKeys() []string

func (*KeyType) SetTestValue

func (p *KeyType) SetTestValue() *ValueType

func (*KeyType) String

func (*KeyType) String() string

func (*KeyType) TableName

func (*KeyType) TableName() string

func (*KeyType) ValidateKey

func (*KeyType) ValidateKey(key string) error

type KubeWatchResult

type KubeWatchResult struct {
	Timestamp            *timestamp.Timestamp      `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Kind                 string                    `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
	WatchType            KubeWatchResult_WatchType `protobuf:"varint,3,opt,name=watchType,proto3,enum=typed.KubeWatchResult_WatchType" json:"watchType,omitempty"`
	Payload              string                    `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                  `json:"-"`
	XXX_unrecognized     []byte                    `json:"-"`
	XXX_sizecache        int32                     `json:"-"`
}

func (*KubeWatchResult) Descriptor

func (*KubeWatchResult) Descriptor() ([]byte, []int)

func (*KubeWatchResult) GetKind

func (m *KubeWatchResult) GetKind() string

func (*KubeWatchResult) GetPayload

func (m *KubeWatchResult) GetPayload() string

func (*KubeWatchResult) GetTimestamp

func (m *KubeWatchResult) GetTimestamp() *timestamp.Timestamp

func (*KubeWatchResult) GetWatchType

func (m *KubeWatchResult) GetWatchType() KubeWatchResult_WatchType

func (*KubeWatchResult) ProtoMessage

func (*KubeWatchResult) ProtoMessage()

func (*KubeWatchResult) Reset

func (m *KubeWatchResult) Reset()

func (*KubeWatchResult) String

func (m *KubeWatchResult) String() string

func (*KubeWatchResult) XXX_DiscardUnknown

func (m *KubeWatchResult) XXX_DiscardUnknown()

func (*KubeWatchResult) XXX_Marshal

func (m *KubeWatchResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KubeWatchResult) XXX_Merge

func (m *KubeWatchResult) XXX_Merge(src proto.Message)

func (*KubeWatchResult) XXX_Size

func (m *KubeWatchResult) XXX_Size() int

func (*KubeWatchResult) XXX_Unmarshal

func (m *KubeWatchResult) XXX_Unmarshal(b []byte) error

type KubeWatchResultTable

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

func OpenKubeWatchResultTable

func OpenKubeWatchResultTable() *KubeWatchResultTable

func (*KubeWatchResultTable) Get

func (*KubeWatchResultTable) GetAllKeysForGivenPartitions

func (t *KubeWatchResultTable) GetAllKeysForGivenPartitions(db badgerwrap.DB, key *WatchTableKey, maxNumberOfKeys int, lookBack int, keyPrefix string) []string

Return all keys in all partitions in the given a lookback period

func (*KubeWatchResultTable) GetMaxKey

func (t *KubeWatchResultTable) GetMaxKey(txn badgerwrap.Txn) (bool, string)

func (*KubeWatchResultTable) GetMaxPartition

func (t *KubeWatchResultTable) GetMaxPartition(txn badgerwrap.Txn) (bool, string)

func (*KubeWatchResultTable) GetMinKey

func (t *KubeWatchResultTable) GetMinKey(txn badgerwrap.Txn) (bool, string)

func (*KubeWatchResultTable) GetMinMaxPartitions

func (t *KubeWatchResultTable) GetMinMaxPartitions(txn badgerwrap.Txn) (bool, string, string)

func (*KubeWatchResultTable) GetMinPartition

func (t *KubeWatchResultTable) GetMinPartition(txn badgerwrap.Txn) (bool, string)

func (*KubeWatchResultTable) GetPartitionsFromTimeRange

func (t *KubeWatchResultTable) GetPartitionsFromTimeRange(txn badgerwrap.Txn, startTime time.Time, endTime time.Time) ([]string, error)

todo: need to add unit test

func (*KubeWatchResultTable) GetPreviousKey

func (t *KubeWatchResultTable) GetPreviousKey(txn badgerwrap.Txn, key *WatchTableKey, keyComparator *WatchTableKey) (*WatchTableKey, error)

func (*KubeWatchResultTable) GetUniquePartitionList

func (t *KubeWatchResultTable) GetUniquePartitionList(txn badgerwrap.Txn) ([]string, error)

func (*KubeWatchResultTable) RangeRead

func (t *KubeWatchResultTable) RangeRead(txn badgerwrap.Txn, keyPrefix *WatchTableKey,
	keyPredicateFn func(string) bool, valPredicateFn func(*KubeWatchResult) bool, startTime time.Time, endTime time.Time) (map[WatchTableKey]*KubeWatchResult, RangeReadStats, error)

func (*KubeWatchResultTable) Set

type KubeWatchResult_WatchType

type KubeWatchResult_WatchType int32
const (
	KubeWatchResult_ADD    KubeWatchResult_WatchType = 0
	KubeWatchResult_UPDATE KubeWatchResult_WatchType = 1
	KubeWatchResult_DELETE KubeWatchResult_WatchType = 2
)

func (KubeWatchResult_WatchType) EnumDescriptor

func (KubeWatchResult_WatchType) EnumDescriptor() ([]byte, []int)

func (KubeWatchResult_WatchType) String

func (x KubeWatchResult_WatchType) String() string

type MinMaxPartitionsGetter

type MinMaxPartitionsGetter interface {
	GetMinMaxPartitions(badgerwrap.Txn) (bool, string, string)
}

type RangeReadStats

type RangeReadStats struct {
	TableName                     string
	PartitionCount                int
	RowsVisitedCount              int
	RowsPassedKeyPredicateCount   int
	RowsPassedValuePredicateCount int
	Elapsed                       time.Duration
}

func (RangeReadStats) Log

func (stats RangeReadStats) Log(requestId string)

type ResourceEventCounts

type ResourceEventCounts struct {
	MapMinToEvents       map[int64]*EventCounts `` /* 170-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*ResourceEventCounts) Descriptor

func (*ResourceEventCounts) Descriptor() ([]byte, []int)

func (*ResourceEventCounts) GetMapMinToEvents

func (m *ResourceEventCounts) GetMapMinToEvents() map[int64]*EventCounts

func (*ResourceEventCounts) ProtoMessage

func (*ResourceEventCounts) ProtoMessage()

func (*ResourceEventCounts) Reset

func (m *ResourceEventCounts) Reset()

func (*ResourceEventCounts) String

func (m *ResourceEventCounts) String() string

func (*ResourceEventCounts) XXX_DiscardUnknown

func (m *ResourceEventCounts) XXX_DiscardUnknown()

func (*ResourceEventCounts) XXX_Marshal

func (m *ResourceEventCounts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ResourceEventCounts) XXX_Merge

func (m *ResourceEventCounts) XXX_Merge(src proto.Message)

func (*ResourceEventCounts) XXX_Size

func (m *ResourceEventCounts) XXX_Size() int

func (*ResourceEventCounts) XXX_Unmarshal

func (m *ResourceEventCounts) XXX_Unmarshal(b []byte) error

type ResourceEventCountsTable

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

func OpenResourceEventCountsTable

func OpenResourceEventCountsTable() *ResourceEventCountsTable

func (*ResourceEventCountsTable) Get

func (*ResourceEventCountsTable) GetAllKeysForGivenPartitions

func (t *ResourceEventCountsTable) GetAllKeysForGivenPartitions(db badgerwrap.DB, key *EventCountKey, maxNumberOfKeys int, lookBack int, keyPrefix string) []string

Return all keys in all partitions in the given a lookback period

func (*ResourceEventCountsTable) GetMaxKey

func (t *ResourceEventCountsTable) GetMaxKey(txn badgerwrap.Txn) (bool, string)

func (*ResourceEventCountsTable) GetMaxPartition

func (t *ResourceEventCountsTable) GetMaxPartition(txn badgerwrap.Txn) (bool, string)

func (*ResourceEventCountsTable) GetMinKey

func (t *ResourceEventCountsTable) GetMinKey(txn badgerwrap.Txn) (bool, string)

func (*ResourceEventCountsTable) GetMinMaxPartitions

func (t *ResourceEventCountsTable) GetMinMaxPartitions(txn badgerwrap.Txn) (bool, string, string)

func (*ResourceEventCountsTable) GetMinPartition

func (t *ResourceEventCountsTable) GetMinPartition(txn badgerwrap.Txn) (bool, string)

func (*ResourceEventCountsTable) GetOrDefault

func (*ResourceEventCountsTable) GetPartitionsFromTimeRange

func (t *ResourceEventCountsTable) GetPartitionsFromTimeRange(txn badgerwrap.Txn, startTime time.Time, endTime time.Time) ([]string, error)

todo: need to add unit test

func (*ResourceEventCountsTable) GetPreviousKey

func (t *ResourceEventCountsTable) GetPreviousKey(txn badgerwrap.Txn, key *EventCountKey, keyComparator *EventCountKey) (*EventCountKey, error)

func (*ResourceEventCountsTable) GetUniquePartitionList

func (t *ResourceEventCountsTable) GetUniquePartitionList(txn badgerwrap.Txn) ([]string, error)

func (*ResourceEventCountsTable) RangeRead

func (t *ResourceEventCountsTable) RangeRead(txn badgerwrap.Txn, keyPrefix *EventCountKey,
	keyPredicateFn func(string) bool, valPredicateFn func(*ResourceEventCounts) bool, startTime time.Time, endTime time.Time) (map[EventCountKey]*ResourceEventCounts, RangeReadStats, error)

func (*ResourceEventCountsTable) Set

type ResourceSummary

type ResourceSummary struct {
	FirstSeen    *timestamp.Timestamp `protobuf:"bytes,1,opt,name=firstSeen,proto3" json:"firstSeen,omitempty"`
	LastSeen     *timestamp.Timestamp `protobuf:"bytes,2,opt,name=lastSeen,proto3" json:"lastSeen,omitempty"`
	CreateTime   *timestamp.Timestamp `protobuf:"bytes,3,opt,name=createTime,proto3" json:"createTime,omitempty"`
	DeletedAtEnd bool                 `protobuf:"varint,4,opt,name=deletedAtEnd,proto3" json:"deletedAtEnd,omitempty"`
	// List of relationships.  Direction does not matter.  Examples:
	// A Pod has a relationship to its namespace, ReplicaSet or StatefulSet, node
	// A ReplicaSet has a relationship to deployment and namespace
	// A node might have a relationship to a rack (maybe latery, as this is virtual)
	// We dont need relationships in both directions.  We can union them at query time
	// Uses same key format here as this overall table
	Relationships        []string `protobuf:"bytes,5,rep,name=relationships,proto3" json:"relationships,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Enough information to draw a timeline and hierarchy Key: /<kind>/<namespace>/<name>/<uid>

func (*ResourceSummary) Descriptor

func (*ResourceSummary) Descriptor() ([]byte, []int)

func (*ResourceSummary) GetCreateTime

func (m *ResourceSummary) GetCreateTime() *timestamp.Timestamp

func (*ResourceSummary) GetDeletedAtEnd

func (m *ResourceSummary) GetDeletedAtEnd() bool

func (*ResourceSummary) GetFirstSeen

func (m *ResourceSummary) GetFirstSeen() *timestamp.Timestamp

func (*ResourceSummary) GetLastSeen

func (m *ResourceSummary) GetLastSeen() *timestamp.Timestamp

func (*ResourceSummary) GetRelationships

func (m *ResourceSummary) GetRelationships() []string

func (*ResourceSummary) ProtoMessage

func (*ResourceSummary) ProtoMessage()

func (*ResourceSummary) Reset

func (m *ResourceSummary) Reset()

func (*ResourceSummary) String

func (m *ResourceSummary) String() string

func (*ResourceSummary) XXX_DiscardUnknown

func (m *ResourceSummary) XXX_DiscardUnknown()

func (*ResourceSummary) XXX_Marshal

func (m *ResourceSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ResourceSummary) XXX_Merge

func (m *ResourceSummary) XXX_Merge(src proto.Message)

func (*ResourceSummary) XXX_Size

func (m *ResourceSummary) XXX_Size() int

func (*ResourceSummary) XXX_Unmarshal

func (m *ResourceSummary) XXX_Unmarshal(b []byte) error

type ResourceSummaryKey

type ResourceSummaryKey struct {
	PartitionId string
	Kind        string
	Namespace   string
	Name        string
	Uid         string
}

func NewResourceSummaryKey

func NewResourceSummaryKey(timestamp time.Time, kind string, namespace string, name string, uid string) *ResourceSummaryKey

func NewResourceSummaryKeyComparator

func NewResourceSummaryKeyComparator(kind string, namespace string, name string, uid string) *ResourceSummaryKey

func (*ResourceSummaryKey) Parse

func (k *ResourceSummaryKey) Parse(key string) error

func (*ResourceSummaryKey) SetPartitionId

func (k *ResourceSummaryKey) SetPartitionId(newPartitionId string)

func (*ResourceSummaryKey) String

func (k *ResourceSummaryKey) String() string

todo: need to make sure it can work as keyPrefix when some fields are empty

func (*ResourceSummaryKey) TableName

func (*ResourceSummaryKey) TableName() string

func (*ResourceSummaryKey) ValidateKey

func (*ResourceSummaryKey) ValidateKey(key string) error

type ResourceSummaryTable

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

func OpenResourceSummaryTable

func OpenResourceSummaryTable() *ResourceSummaryTable

func (*ResourceSummaryTable) Get

func (*ResourceSummaryTable) GetAllKeysForGivenPartitions

func (t *ResourceSummaryTable) GetAllKeysForGivenPartitions(db badgerwrap.DB, key *ResourceSummaryKey, maxNumberOfKeys int, lookBack int, keyPrefix string) []string

Return all keys in all partitions in the given a lookback period

func (*ResourceSummaryTable) GetMaxKey

func (t *ResourceSummaryTable) GetMaxKey(txn badgerwrap.Txn) (bool, string)

func (*ResourceSummaryTable) GetMaxPartition

func (t *ResourceSummaryTable) GetMaxPartition(txn badgerwrap.Txn) (bool, string)

func (*ResourceSummaryTable) GetMinKey

func (t *ResourceSummaryTable) GetMinKey(txn badgerwrap.Txn) (bool, string)

func (*ResourceSummaryTable) GetMinMaxPartitions

func (t *ResourceSummaryTable) GetMinMaxPartitions(txn badgerwrap.Txn) (bool, string, string)

func (*ResourceSummaryTable) GetMinPartition

func (t *ResourceSummaryTable) GetMinPartition(txn badgerwrap.Txn) (bool, string)

func (*ResourceSummaryTable) GetPartitionsFromTimeRange

func (t *ResourceSummaryTable) GetPartitionsFromTimeRange(txn badgerwrap.Txn, startTime time.Time, endTime time.Time) ([]string, error)

todo: need to add unit test

func (*ResourceSummaryTable) GetPreviousKey

func (t *ResourceSummaryTable) GetPreviousKey(txn badgerwrap.Txn, key *ResourceSummaryKey, keyComparator *ResourceSummaryKey) (*ResourceSummaryKey, error)

func (*ResourceSummaryTable) GetUniquePartitionList

func (t *ResourceSummaryTable) GetUniquePartitionList(txn badgerwrap.Txn) ([]string, error)

func (*ResourceSummaryTable) RangeRead

func (t *ResourceSummaryTable) RangeRead(txn badgerwrap.Txn, keyPrefix *ResourceSummaryKey,
	keyPredicateFn func(string) bool, valPredicateFn func(*ResourceSummary) bool, startTime time.Time, endTime time.Time) (map[ResourceSummaryKey]*ResourceSummary, RangeReadStats, error)

func (*ResourceSummaryTable) Set

type Tables

type Tables interface {
	ResourceSummaryTable() *ResourceSummaryTable
	EventCountTable() *ResourceEventCountsTable
	WatchTable() *KubeWatchResultTable
	WatchActivityTable() *WatchActivityTable
	Db() badgerwrap.DB
	GetMinAndMaxPartition() (bool, string, string, error)
	GetTableNames() []string
	GetTables() []interface{}
	GetMinAndMaxPartitionWithTxn(badgerwrap.Txn) (bool, string, string)
}

func NewTableList

func NewTableList(db badgerwrap.DB) Tables

type ValueType

type ValueType struct {
}

func (*ValueType) ProtoMessage

func (p *ValueType) ProtoMessage()

func (*ValueType) Reset

func (p *ValueType) Reset()

func (*ValueType) String

func (p *ValueType) String() string

type ValueTypeTable

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

func OpenValueTypeTable

func OpenValueTypeTable() *ValueTypeTable

func (*ValueTypeTable) Get

func (t *ValueTypeTable) Get(txn badgerwrap.Txn, key string) (*ValueType, error)

func (*ValueTypeTable) GetMaxKey

func (t *ValueTypeTable) GetMaxKey(txn badgerwrap.Txn) (bool, string)

func (*ValueTypeTable) GetMinKey

func (t *ValueTypeTable) GetMinKey(txn badgerwrap.Txn) (bool, string)

func (*ValueTypeTable) GetMinMaxPartitions

func (t *ValueTypeTable) GetMinMaxPartitions(txn badgerwrap.Txn) (bool, string, string)

func (*ValueTypeTable) GetPartitionsFromTimeRange

func (t *ValueTypeTable) GetPartitionsFromTimeRange(txn badgerwrap.Txn, startTime time.Time, endTime time.Time) ([]string, error)

todo: need to add unit test

func (*ValueTypeTable) GetPreviousKey

func (t *ValueTypeTable) GetPreviousKey(txn badgerwrap.Txn, key *KeyType, keyComparator *KeyType) (*KeyType, error)

func (*ValueTypeTable) GetUniquePartitionList

func (t *ValueTypeTable) GetUniquePartitionList(txn badgerwrap.Txn) ([]string, error)

func (*ValueTypeTable) RangeRead

func (t *ValueTypeTable) RangeRead(txn badgerwrap.Txn, keyPrefix *KeyType,
	keyPredicateFn func(string) bool, valPredicateFn func(*ValueType) bool, startTime time.Time, endTime time.Time) (map[KeyType]*ValueType, RangeReadStats, error)

func (*ValueTypeTable) Set

func (t *ValueTypeTable) Set(txn badgerwrap.Txn, key string, value *ValueType) error

type WatchActivity

type WatchActivity struct {
	// List of timestamps where `watch` event did not contain changes from previous event
	NoChangeAt []int64 `protobuf:"varint,1,rep,packed,name=NoChangeAt,proto3" json:"NoChangeAt,omitempty"`
	// List of timestamps where 'watch' event contained a change from previous event
	ChangedAt            []int64  `protobuf:"varint,2,rep,packed,name=ChangedAt,proto3" json:"ChangedAt,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Track when 'watch' occurred for a resource within partition

func (*WatchActivity) Descriptor

func (*WatchActivity) Descriptor() ([]byte, []int)

func (*WatchActivity) GetChangedAt

func (m *WatchActivity) GetChangedAt() []int64

func (*WatchActivity) GetNoChangeAt

func (m *WatchActivity) GetNoChangeAt() []int64

func (*WatchActivity) ProtoMessage

func (*WatchActivity) ProtoMessage()

func (*WatchActivity) Reset

func (m *WatchActivity) Reset()

func (*WatchActivity) String

func (m *WatchActivity) String() string

func (*WatchActivity) XXX_DiscardUnknown

func (m *WatchActivity) XXX_DiscardUnknown()

func (*WatchActivity) XXX_Marshal

func (m *WatchActivity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WatchActivity) XXX_Merge

func (m *WatchActivity) XXX_Merge(src proto.Message)

func (*WatchActivity) XXX_Size

func (m *WatchActivity) XXX_Size() int

func (*WatchActivity) XXX_Unmarshal

func (m *WatchActivity) XXX_Unmarshal(b []byte) error

type WatchActivityKey

type WatchActivityKey struct {
	PartitionId string
	Kind        string
	Namespace   string
	Name        string
	Uid         string
}

func NewWatchActivityKey

func NewWatchActivityKey(partitionId string, kind string, namespace string, name string, uid string) *WatchActivityKey

func NewWatchActivityKeyComparator

func NewWatchActivityKeyComparator(kind string, namespace string, name string, uid string) *WatchActivityKey

func (*WatchActivityKey) Parse

func (k *WatchActivityKey) Parse(key string) error

func (*WatchActivityKey) SetPartitionId

func (k *WatchActivityKey) SetPartitionId(newPartitionId string)

func (*WatchActivityKey) String

func (k *WatchActivityKey) String() string

todo: need to make sure it can work as keyPrefix when some fields are empty

func (*WatchActivityKey) TableName

func (*WatchActivityKey) TableName() string

func (*WatchActivityKey) ValidateKey

func (*WatchActivityKey) ValidateKey(key string) error

type WatchActivityTable

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

func OpenWatchActivityTable

func OpenWatchActivityTable() *WatchActivityTable

func (*WatchActivityTable) Get

func (*WatchActivityTable) GetAllKeysForGivenPartitions

func (t *WatchActivityTable) GetAllKeysForGivenPartitions(db badgerwrap.DB, key *WatchActivityKey, maxNumberOfKeys int, lookBack int, keyPrefix string) []string

Return all keys in all partitions in the given a lookback period

func (*WatchActivityTable) GetMaxKey

func (t *WatchActivityTable) GetMaxKey(txn badgerwrap.Txn) (bool, string)

func (*WatchActivityTable) GetMaxPartition

func (t *WatchActivityTable) GetMaxPartition(txn badgerwrap.Txn) (bool, string)

func (*WatchActivityTable) GetMinKey

func (t *WatchActivityTable) GetMinKey(txn badgerwrap.Txn) (bool, string)

func (*WatchActivityTable) GetMinMaxPartitions

func (t *WatchActivityTable) GetMinMaxPartitions(txn badgerwrap.Txn) (bool, string, string)

func (*WatchActivityTable) GetMinPartition

func (t *WatchActivityTable) GetMinPartition(txn badgerwrap.Txn) (bool, string)

func (*WatchActivityTable) GetOrDefault

func (t *WatchActivityTable) GetOrDefault(txn badgerwrap.Txn, key string) (*WatchActivity, error)

func (*WatchActivityTable) GetPartitionsFromTimeRange

func (t *WatchActivityTable) GetPartitionsFromTimeRange(txn badgerwrap.Txn, startTime time.Time, endTime time.Time) ([]string, error)

todo: need to add unit test

func (*WatchActivityTable) GetPreviousKey

func (t *WatchActivityTable) GetPreviousKey(txn badgerwrap.Txn, key *WatchActivityKey, keyComparator *WatchActivityKey) (*WatchActivityKey, error)

func (*WatchActivityTable) GetUniquePartitionList

func (t *WatchActivityTable) GetUniquePartitionList(txn badgerwrap.Txn) ([]string, error)

func (*WatchActivityTable) RangeRead

func (t *WatchActivityTable) RangeRead(txn badgerwrap.Txn, keyPrefix *WatchActivityKey,
	keyPredicateFn func(string) bool, valPredicateFn func(*WatchActivity) bool, startTime time.Time, endTime time.Time) (map[WatchActivityKey]*WatchActivity, RangeReadStats, error)

func (*WatchActivityTable) Set

func (t *WatchActivityTable) Set(txn badgerwrap.Txn, key string, value *WatchActivity) error

type WatchTableKey

type WatchTableKey struct {
	PartitionId string
	Kind        string
	Namespace   string
	Name        string
	Timestamp   time.Time
}

func NewWatchTableKey

func NewWatchTableKey(partitionId string, kind string, namespace string, name string, timestamp time.Time) *WatchTableKey

func NewWatchTableKeyComparator

func NewWatchTableKeyComparator(kind string, namespace string, name string, timestamp time.Time) *WatchTableKey

func (*WatchTableKey) IsNameAlreadyDelimited

func (k *WatchTableKey) IsNameAlreadyDelimited() bool

func (*WatchTableKey) Parse

func (k *WatchTableKey) Parse(key string) error

func (*WatchTableKey) SetPartitionId

func (k *WatchTableKey) SetPartitionId(newPartitionId string)

func (*WatchTableKey) String

func (k *WatchTableKey) String() string

todo: need to make sure it can work as keyPrefix when some fields are empty

func (*WatchTableKey) TableName

func (*WatchTableKey) TableName() string

func (*WatchTableKey) ValidateKey

func (*WatchTableKey) ValidateKey(key string) error

Jump to

Keyboard shortcuts

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