Documentation ¶
Overview ¶
Package partitioning provides ways to describe how the set of facts have been partitioned.
Partitions are describes in 2 axis, the Key Encoding which describe how the fact is converted to/from a diskview Key, and Range, which describe the subset of points in the space that the partition covers. Currently all spaces are Hash partitioned, that might change in the future.
Index ¶
- func CarouselHashPartition(partition FactPartition) rpc.CarouselHashPartitionRequest
- func HashPO(predicate uint64, obj rpc.KGObject) space.Hash64
- func HashSP(subject, predicate uint64) space.Hash64
- func String(p FactPartition) string
- type FactPartition
- func NewHashPredicateObject(hashRange space.Range) FactPartition
- func NewHashPredicateObjectPartition(partition, numPartitions int) FactPartition
- func NewHashSubjectPredicate(hashRange space.Range) FactPartition
- func NewHashSubjectPredicatePartition(partition, numPartitions int) FactPartition
- func PartitionFromCarouselHashPartition(p rpc.CarouselHashPartitionRequest) (FactPartition, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CarouselHashPartition ¶
func CarouselHashPartition(partition FactPartition) rpc.CarouselHashPartitionRequest
CarouselHashPartition will create a rpc.CarouselHashPartitionRequest for use in carousel RPCs which describes the supplied FactPartition
func String ¶
func String(p FactPartition) string
String returns a textual description of the partition, for human consumption
Types ¶
type FactPartition ¶
type FactPartition interface { // HasFact returns true if the supplied fact is part of this partition HasFact(f *rpc.Fact) bool // Encoding returns an indication of how keys are constructed/ordered in this partition Encoding() rpc.FactKeyEncoding // HashRange returns the range out of a Hash64 hash space that this partition // occupies HashRange() space.Range }
FactPartition describes a particular partitioning of fact data, the primary functionality this provides is to ask if a particular fact is in the partition.
func NewHashPredicateObject ¶
func NewHashPredicateObject(hashRange space.Range) FactPartition
NewHashPredicateObject constructs a new FactPartition instance for a Predicate+Object based hash partition. The partition contains all the hashes within the supplied 'hashRange'
func NewHashPredicateObjectPartition ¶
func NewHashPredicateObjectPartition(partition, numPartitions int) FactPartition
NewHashPredicateObjectPartition will construct a new FactPartition instance for a Predicate+Object based hash partition. The hash space is divided up into 'numPartitions' sections and the returned Partition is for the n-th item in the divided space. partition should therefore be strictly less than numPartitions. for example with numPartitions equal to 4, the available partions are 0,1,2,3.
func NewHashSubjectPredicate ¶
func NewHashSubjectPredicate(hashRange space.Range) FactPartition
NewHashSubjectPredicate constructs a new FactPartition instance for a Subject+Predicate based hash partition. The partition contains all the hashes within the supplied 'hashRange'
func NewHashSubjectPredicatePartition ¶
func NewHashSubjectPredicatePartition(partition, numPartitions int) FactPartition
NewHashSubjectPredicatePartition will construct a new FactPartition instance for a Subject+Predicate based hash partition. The hash space is divided up into 'numPartitions' sections and the returned Partition is for the n-th item in the divided space. partition should therefore be strictly less than numPartitions. for example with numPartitions equal to 4, the available partions are 0,1,2,3.
func PartitionFromCarouselHashPartition ¶
func PartitionFromCarouselHashPartition(p rpc.CarouselHashPartitionRequest) (FactPartition, error)
PartitionFromCarouselHashPartition will take a CarouselHashPartitionRequest structure used in Carousel RPC requests and return an equivalent FactPartition instance from it.