partition

package
v0.0.0-...-d807755 Latest Latest
Warning

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

Go to latest
Published: May 7, 2014 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortPartition

func AbortPartition(id uint64, dest RemoteServer) (bool, error)

func CommitPartition

func CommitPartition(id uint64, dest RemoteServer) (bool, error)

func PreCommitPartition

func PreCommitPartition(r Ranges, id uint64, dest RemoteServer) (bool, error)

Types

type Diff

type Diff struct {
	From  int
	To    int
	Start uint64
	End   uint64
}

func GenerateDiffs

func GenerateDiffs(oldPS, newPS PartitionSet) []Diff

type PartitionDelegate

type PartitionDelegate interface {
	GetDaemon(uint64) RemoteServer
	DeleteDaemon(uint64)
	GetLocalID() uint64
	Logger() *mlog.MLog
}

type PartitionSet

type PartitionSet struct {
	Shards []Shard
	// contains filtered or unexported fields
}

func MakeKeySpace

func MakeKeySpace(n int, del PartitionDelegate) *PartitionSet

n must be a postive power of two, 2 4 8 16 32 etc

func MakePartitionSet

func MakePartitionSet(ns []ShardCopy, del PartitionDelegate) *PartitionSet

func (*PartitionSet) Abort

func (pts *PartitionSet) Abort(updateID uint64) bool

func (*PartitionSet) AddDaemon

func (t *PartitionSet) AddDaemon(id uint64)

function that gets called when a new daemon is commited to the system. Argument : id of the daemon

func (*PartitionSet) ApplyCopyDiffs

func (pts *PartitionSet) ApplyCopyDiffs(diffs []Diff) bool

func (*PartitionSet) CalculateDiffs

func (ps *PartitionSet) CalculateDiffs(keys []uint) ([]Diff, *PartitionSet)

func (*PartitionSet) CanCommit

func (t *PartitionSet) CanCommit() bool

func (*PartitionSet) Commit

func (pts *PartitionSet) Commit(updateID uint64) bool

func (*PartitionSet) Copy

func (t *PartitionSet) Copy() PartitionSet

func (*PartitionSet) GarbageCollect

func (pts *PartitionSet) GarbageCollect()

func (*PartitionSet) Get

func (pts *PartitionSet) Get(key string) (string, error)

func (*PartitionSet) GetNKeysForEachShard

func (pts *PartitionSet) GetNKeysForEachShard() ([]uint, error)

func (*PartitionSet) GetShardCopies

func (pts *PartitionSet) GetShardCopies() []ShardCopy

func (*PartitionSet) GetShardForKey

func (t *PartitionSet) GetShardForKey(key string) Shard

func (*PartitionSet) IDs

func (pts *PartitionSet) IDs() [][]uint64

func (*PartitionSet) IntRanges

func (ps *PartitionSet) IntRanges() []uint64

func (*PartitionSet) PreCommit

func (pts *PartitionSet) PreCommit(r Ranges, updateID uint64) bool

func (*PartitionSet) Put

func (pts *PartitionSet) Put(key, value string, options map[string]bool) (error, map[string]string)

func (*PartitionSet) Ranges

func (ps *PartitionSet) Ranges() []Range

func (*PartitionSet) Recalc

func (o *PartitionSet) Recalc(keys []uint) PartitionSet

func (*PartitionSet) Verify

func (ps *PartitionSet) Verify() bool

type PreCommitRequest

type PreCommitRequest struct {
	R  Ranges
	Id uint64
}

type Shard

type Shard struct {
	Start   uint64
	End     uint64
	Daemons map[uint64]bool
	Keys    uint
	// contains filtered or unexported fields
}

func (*Shard) Copy

func (self *Shard) Copy() *Shard

func (*Shard) CopyKVs

func (shard *Shard) CopyKVs(otherShard Shard, start, end uint64) bool

func (*Shard) GarbageCollect

func (shard *Shard) GarbageCollect()

func (*Shard) GetDaemons

func (t *Shard) GetDaemons() map[uint64]bool

func (*Shard) GetInfoForShard

func (shard *Shard) GetInfoForShard() (error, uint)

func (*Shard) IDs

func (shard *Shard) IDs() []uint64

func (*Shard) Put

func (shard *Shard) Put(key, value string, options map[string]bool) (error, map[string]string)

Jump to

Keyboard shortcuts

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