partitioning

package
Version: v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

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

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 HashPO

func HashPO(predicate uint64, obj rpc.KGObject) space.Hash64

HashPO returns a consistent Hash64 value calculated from the predicate & object

func HashSP

func HashSP(subject, predicate uint64) space.Hash64

HashSP returns a consistent Hash64 value calculated from the subject & predicate

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL