ring

package
v0.0.0-...-a0bb070 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadMagicNumber     = errors.New("bad magic number")
	ErrUnknownRingVersion = errors.New("unknown ring version")
)

Functions

This section is empty.

Types

type Device

type Device struct {
	Id              int     `json:"id"`
	Device          string  `json:"device"`
	Ip              string  `json:"ip"`
	Meta            string  `json:"meta"`
	Port            int     `json:"port"`
	Region          int     `json:"region"`
	ReplicationIp   string  `json:"replication_ip"`
	ReplicationPort int     `json:"replication_port"`
	Weight          float64 `json:"weight"`
	Zone            int     `json:"zone"`
}

func ListLocalDevices

func ListLocalDevices(ringType, prefix, suffix string, policy int,
	port int) ([]*Device, error)

func (*Device) String

func (d *Device) String() string

type MoreNodes

type MoreNodes interface {
	Next() *Device
}

type Ring

type Ring interface {
	GetNodes(partition uint64) []*Device

	GetJobNodes(partition uint64, localDevice int) ([]*Device, bool)

	GetPartition(account string, container string, object string) uint64

	LocalDevices(localPort int) ([]*Device, error)

	GetMoreNodes(partition uint64) MoreNodes

	ReplicaCount() (cnt uint64)

	PartitionCount() (cnt uint64)
}

func GetRing

func GetRing(ringType, prefix, suffix string, policy int) (Ring, error)

GetRing returns the current ring given the ring_type ("account", "container", "object"), hash path prefix, and hash path suffix. An error is raised if the requested ring does not exist.

func LoadRing

func LoadRing(path string, prefix string, suffix string) (Ring, error)

Jump to

Keyboard shortcuts

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