ring

package
v0.0.0-...-1ca2a29 Latest Latest
Warning

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

Go to latest
Published: May 23, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Disconnected = fmt.Errorf("Disconnected from memcache server")
	CacheMiss    = fmt.Errorf("Server cache miss")
)

Functions

func NewMemcacheRing

func NewMemcacheRing(confPath string) (*memcacheRing, error)

func NewMemcacheRingFromConfig

func NewMemcacheRingFromConfig(config conf.Config) (*memcacheRing, error)

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 (*Device) String

func (d *Device) String() string

type MemcacheRing

type MemcacheRing interface {
	Decr(key string, delta int64, timeout int) (int64, error)
	Delete(key string) error
	Get(key string) (interface{}, error)
	GetStructured(key string, val interface{}) error
	GetMulti(serverKey string, keys []string) (map[string]interface{}, error)
	Incr(key string, delta int64, timeout int) (int64, error)
	Set(key string, value interface{}, timeout int) error
	SetMulti(serverKey string, values map[string]interface{}, timeout int) error
}

type MoreNodes

type MoreNodes interface {
	Next() *Device
}

type Ring

type Ring interface {
	GetNodes(partition uint64) (response []*Device)
	GetNodesInOrder(partition uint64) (response []*Device)
	GetJobNodes(partition uint64, localDevice int) (response []*Device, handoff bool)
	GetPartition(account string, container string, object string) uint64
	LocalDevices(localPort int) (devs []*Device, err error)
	AllDevices() (devs []Device)
	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