import "go.chromium.org/luci/server/tq/internal/partition"
Package partition encapsulates partitioning and querying large keyspace which can't be expressed even as uint64.
All to/from string functions use hex encoding.
type Partition struct { Low big.Int // inclusive High big.Int // exclusive. May be equal to max SHA2 hash value + 1. }
Partition represents a range [Low..High).
func (p Partition) EducatedSplitAfter(exclusive string, beforeItems, targetItems, maxShards int) SortedPartitions
EducatedSplitAfter splits partition after a given boundary assuming constant density s.t. each shard has approximately targetItems.
Caps the number of resulting partitions to at most maxShards. panics if called on invalid data.
func (p Partition) Split(shards int) SortedPartitions
SortedPartitions are disjoint partitions sorted by ascending .Low field.
func (ps SortedPartitions) OnlyIn(n int, key func(i int) string, use func(l, h int), keySpaceBytes int)
OnlyIn efficiently returns a subsequence of the `n` sorted by key objects whose key belongs to one of the partitions.
Calls use(i,j) for each objects[i:j] which belong to the range.
type SortedPartitionsBuilder struct {
// contains filtered or unexported fields
}
SortedPartitionsBuilder constructs a sequence of partitions by excluding chunks from a starting partion.
Not intended to scale to large number of exclusion operations.
func NewSortedPartitionsBuilder(p *Partition) SortedPartitionsBuilder
func (b *SortedPartitionsBuilder) Exclude(exclude *Partition)
func (b *SortedPartitionsBuilder) IsEmpty() bool
func (b *SortedPartitionsBuilder) Result() SortedPartitions
Package partition imports 6 packages (graph) and is imported by 9 packages. Updated 2021-01-26. Refresh now. Tools for package owners.