partitions

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRIMARY = Kind(iota + 1)
	BACKUP
)

Variables

This section is empty.

Functions

func HKey

func HKey(name, key string) uint64

func SetHashFunc

func SetHashFunc(h hasher.Hasher)

Types

type Fragment

type Fragment interface {
	Name() string
	Stats() storage.Stats
	Length() int
	Move(partID uint64, kind Kind, name string, owner discovery.Member) error
	Compaction() (bool, error)
	Destroy() error
	Close() error
}

type Kind

type Kind int

func (Kind) String

func (k Kind) String() string

type Partition

type Partition struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Partition is a basic, logical storage unit in Olric and stores DMaps in a sync.Map.

func (*Partition) ID

func (p *Partition) ID() uint64

func (*Partition) Kind

func (p *Partition) Kind() Kind

func (*Partition) Length

func (p *Partition) Length() int

func (*Partition) Map

func (p *Partition) Map() *sync.Map

func (*Partition) Owner

func (p *Partition) Owner() discovery.Member

Owner returns partition Owner. It's not thread-safe.

func (*Partition) OwnerCount

func (p *Partition) OwnerCount() int

OwnerCount returns the current Owner count of a partition.

func (*Partition) Owners

func (p *Partition) Owners() []discovery.Member

Owners loads the partition owners from atomic.Value and returns.

func (*Partition) SetOwners

func (p *Partition) SetOwners(owners []discovery.Member)

type Partitions

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

func New

func New(count uint64, kind Kind) *Partitions

func (*Partitions) PartitionByHKey

func (ps *Partitions) PartitionByHKey(hkey uint64) *Partition

PartitionByHKey returns the partition for the given HKey

func (*Partitions) PartitionByID

func (ps *Partitions) PartitionByID(partID uint64) *Partition

PartitionByID returns the partition for the given HKey

func (*Partitions) PartitionIDByHKey

func (ps *Partitions) PartitionIDByHKey(hkey uint64) uint64

PartitionIDByHKey returns partition ID for a given HKey.

func (*Partitions) PartitionOwnersByHKey

func (ps *Partitions) PartitionOwnersByHKey(hkey uint64) []discovery.Member

PartitionOwnersByHKey loads the partition owners list for a given hkey.

func (*Partitions) PartitionOwnersByID

func (ps *Partitions) PartitionOwnersByID(partID uint64) []discovery.Member

PartitionOwnersByID loads the partition owners list for a given hkey.

Jump to

Keyboard shortcuts

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