Documentation
¶
Overview ¶
pkoracle package contains pk - segment mapping logic.
Index ¶
- type BloomFilterSet
- func (s *BloomFilterSet) AddHistoricalStats(stats *storage.PkStatistics)
- func (s *BloomFilterSet) BatchPkExist(lc *storage.BatchLocationsCache) []bool
- func (s *BloomFilterSet) BloomFilterExist() bool
- func (s *BloomFilterSet) ID() int64
- func (s *BloomFilterSet) MayPkExist(lc *storage.LocationsCache) bool
- func (s *BloomFilterSet) Partition() int64
- func (s *BloomFilterSet) Stats() *storage.PkStatistics
- func (s *BloomFilterSet) Type() commonpb.SegmentState
- func (s *BloomFilterSet) UpdateBloomFilter(pks []storage.PrimaryKey)
- type Candidate
- type CandidateFilter
- type PkOracle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BloomFilterSet ¶
type BloomFilterSet struct {
// contains filtered or unexported fields
}
BloomFilterSet is one implementation of Candidate with bloom filter in statslog.
func NewBloomFilterSet ¶
func NewBloomFilterSet(segmentID int64, paritionID int64, segType commonpb.SegmentState) *BloomFilterSet
NewBloomFilterSet returns a new BloomFilterSet.
func (*BloomFilterSet) AddHistoricalStats ¶
func (s *BloomFilterSet) AddHistoricalStats(stats *storage.PkStatistics)
AddHistoricalStats add loaded historical stats.
func (*BloomFilterSet) BatchPkExist ¶
func (s *BloomFilterSet) BatchPkExist(lc *storage.BatchLocationsCache) []bool
func (*BloomFilterSet) BloomFilterExist ¶
func (s *BloomFilterSet) BloomFilterExist() bool
Have BloomFilter exist
func (*BloomFilterSet) MayPkExist ¶
func (s *BloomFilterSet) MayPkExist(lc *storage.LocationsCache) bool
MayPkExist returns whether any bloom filters returns positive.
func (*BloomFilterSet) Partition ¶
func (s *BloomFilterSet) Partition() int64
Partition implements candidate.
func (*BloomFilterSet) Type ¶
func (s *BloomFilterSet) Type() commonpb.SegmentState
Type implements candidate.
func (*BloomFilterSet) UpdateBloomFilter ¶
func (s *BloomFilterSet) UpdateBloomFilter(pks []storage.PrimaryKey)
UpdateBloomFilter updates currentStats with provided pks.
type Candidate ¶
type Candidate interface {
// MayPkExist checks whether primary key could exists in this candidate.
MayPkExist(lc *storage.LocationsCache) bool
BatchPkExist(lc *storage.BatchLocationsCache) []bool
ID() int64
Partition() int64
Type() commonpb.SegmentState
}
Candidate is the interface for pk oracle candidate.
func NewCandidateKey ¶
func NewCandidateKey(id int64, partitionID int64, typ commonpb.SegmentState) Candidate
NewCandidateKey creates a candidateKey and returns as Candidate.
type CandidateFilter ¶
type CandidateFilter func(candidate candidateWithWorker) bool
CandidateFilter filter type for candidate.
func WithPartitionID ¶
func WithPartitionID(partitionID int64) CandidateFilter
WithPartitionID returns CandidateFilter with provided partitionID.
func WithSegmentIDs ¶
func WithSegmentIDs(segmentIDs ...int64) CandidateFilter
WithSegmentIDs returns CandidateFilter with provided segment ids.
func WithSegmentType ¶
func WithSegmentType(typ commonpb.SegmentState) CandidateFilter
WithSegmentType returns CandiateFilter with provided segment type.
func WithWorkerID ¶
func WithWorkerID(workerID int64) CandidateFilter
WithWorkerID returns CandidateFilter with provided worker id.
type PkOracle ¶
type PkOracle interface {
// GetCandidates returns segment candidates of which pk might belongs to.
Get(pk storage.PrimaryKey, filters ...CandidateFilter) ([]int64, error)
BatchGet(pks []storage.PrimaryKey, filters ...CandidateFilter) map[int64][]bool
// RegisterCandidate adds candidate into pkOracle.
Register(candidate Candidate, workerID int64) error
// RemoveCandidate removes candidate
Remove(filters ...CandidateFilter) error
// CheckCandidate checks whether candidate with provided key exists.
Exists(candidate Candidate, workerID int64) bool
}
PkOracle interface for pk oracle.