partition

package
v0.0.0-...-8b501b0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Range

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

Range represents a contiguous UUID region which is split into a number of partitions.

func NewFullRange

func NewFullRange(numPartitions int) (*Range, error)

NewFullRange creates a new range that uses the full UUID value space and splits it into the provided number of partitions.

func NewRange

func NewRange(start, end uuid.UUID, numPartitions int) (*Range, error)

NewRange creates a new range [start, end) and splits it into the provided number of partitions.

func (*Range) Extents

func (r *Range) Extents() (uuid.UUID, uuid.UUID)

Extents returns the [start, end) extents of the entire range.

func (*Range) PartitionExtents

func (r *Range) PartitionExtents(partition int) (uuid.UUID, uuid.UUID, error)

PartitionExtents returns the [start, end) range for the requested partition.

func (*Range) PartitionForID

func (r *Range) PartitionForID(id uuid.UUID) (int, error)

PartitionForID returns the partition index that the provided ID belongs to.

Jump to

Keyboard shortcuts

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