ring

package
v0.0.0-...-b371d68 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAXWORKQLEN = 1000
	MAXWORKERPP = 5
	MAXWORKERS  = 100
	KEEPALIVE   = 30 * time.Second
)
View Source
const TSAVE = uint64(10 * time.Second)

Variables

This section is empty.

Functions

func GetPeerAddr

func GetPeerAddr(id string) string

func Handoff

func Handoff(req *acproto.ACPY2DistRequest, dist []string)

func PartIdx2Shard

func PartIdx2Shard(bits int, partidx int) uint32

func PartIdx2TreeID

func PartIdx2TreeID(bits int, partidx int) uint16

func PartShard2Idx

func PartShard2Idx(bits int, shard uint32) int

func PartShard2TreeID

func PartShard2TreeID(bits int, shard uint32) uint16

func PartTreeID2Idx

func PartTreeID2Idx(bits int, treeid uint16) int

func PartTreeID2Shard

func PartTreeID2Shard(bits int, treeid uint16) uint32

Types

type ConfDBer

type ConfDBer interface {
	Get(*acproto.ACPY2MapDatum) (bool, error)
}

access to _conf database (store sdb)

type ConstrCf

type ConstrCf struct {
	MyId   string
	MyDC   string
	MyRack string
}

func (*ConstrCf) ConfigureParts

func (p *ConstrCf) ConfigureParts(cf *config.Ring) []*Part

type DCPart

type DCPart struct {
	DCName     string
	Servers    []string
	IsBoundary bool
	// contains filtered or unexported fields
}

type Databaser

type Databaser interface {
	Get(*acproto.ACPY2MapDatum) (bool, error)
	GetInternal(string, string) ([]byte, bool)
	SetInternal(string, string, []byte)
	DelInternal(string, string)
	Repartition(*soty.Loc, uint64) (bool, uint64)
}

access to our underlying database

type P

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

func New

func New(name string, db Databaser, myid string, mydc string, myrack string, sdb ConfDBer, grpcp *gclient.Defaults) *P

func (*P) AltPeers

func (p *P) AltPeers(loc *soty.Loc) []string

provide alt server for redirect

func (*P) Close

func (p *P) Close()

func (*P) CurrVer

func (p *P) CurrVer() uint64

func (*P) DistPeers

func (p *P) DistPeers(loc *soty.Loc, dcidx int, splitRack bool, butnot string) ([]string, []string)

func (*P) Distrib

func (p *P) Distrib(loc *soty.Loc, req *acproto.ACPY2DistRequest, onDone func(int))

func (*P) DistribLocal

func (p *P) DistribLocal(loc *soty.Loc, req *acproto.ACPY2DistRequest, onDone func(int))

func (*P) GetConf

func (p *P) GetConf(dcreq string) *acproto.ACPY2RingConfReply

dc == "" => local dc == "*" all

func (*P) GetLoc

func (p *P) GetLoc(shard uint32) *soty.Loc

func (*P) GetLocN

func (p *P) GetLocN(partidx int) *soty.Loc

func (*P) IsStable

func (p *P) IsStable() bool

func (*P) NumDC

func (p *P) NumDC(loc *soty.Loc) int

func (*P) NumParts

func (p *P) NumParts() int

func (*P) NumReplicas

func (p *P) NumReplicas() int

func (*P) PeerUpdate

func (p *P) PeerUpdate(id string, isup bool, iscf bool, first bool, pd *kibitz.Export, dat *acproto.ACPHeartBeat)

receive status updates from peerdb

func (*P) RandomAEPeer

func (p *P) RandomAEPeer(loc *soty.Loc) string

type Part

type Part struct {
	DC []*DCPart // [0] is the local dc

	IsLocal   bool
	StableVer uint64
	// contains filtered or unexported fields
}

func (*Part) DCpart

func (p *Part) DCpart(dcname string) *DCPart

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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