placement

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlacement = defaultPlacement{}

Functions

This section is empty.

Types

type Key

type Key struct {
	TenantID    string
	DatasetName string

	Tenant      uint64
	Dataset     uint64
	Fingerprint uint64
}

Key represents the distribution key.

type Placement

type Placement struct {
	// Note that the instances reference shared objects, and must not be modified.
	Instances []*ring.InstanceDesc
	Shard     uint32
	// contains filtered or unexported fields
}

Placement represents the placement for the given distribution key.

func (*Placement) Next

func (p *Placement) Next() (instance *ring.InstanceDesc, ok bool)

Next returns the next available location address.

type Strategy

type Strategy interface {
	// NumTenantShards returns the number of shards
	// for a tenant from n total.
	NumTenantShards(k Key, n uint32) (size uint32)
	// NumDatasetShards returns the number of shards
	// for a dataset from n total.
	NumDatasetShards(k Key, n uint32) (size uint32)
	// PickShard returns the shard index
	// for a given key from n total.
	PickShard(k Key, n uint32) (shard uint32)
}

Jump to

Keyboard shortcuts

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