voldemort

package module
v0.0.0-...-c25b1bd Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

README

go-voldemort

STILL IN DEVELOPMENT - EXPECT CHANGES

Voldermort client written in Go

The client allows you to either use nice ready made methods (get/put etc) or expose the Voldemort protobufs objects to create your own requests.

There are advantages to both but you need to understand why you are choosing one over the other so I suggest you give the Voldemort wiki a good read first - the link is at the bottom.

Very happy to accept pull requests - please make sure you've run go fmt on all code

Voldemort http://www.voldemort-project.com

Voldemort Wiki https://github.com/voldemort/voldemort/wiki

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// Name of Voldemort cluster
	Name string `xml:"name"`

	// Array of Voldemort servers
	Servers []Server `xml:"server"`
}

The cluster struct holds all the information taken from the Voldemort cluster when it's first connected

type SMetric

type SMetric struct {
	Name  string
	Count int64
	Mean  float64
	Max   int64
	Min   int64
}

type Server

type Server struct {
	Id         int    `xml:"id"`
	Host       string `xml:"host"`
	Http       int    `xml:"http-port"`
	Socket     int    `xml:"socket-port"`
	Partitions string `xml:"partitions"`
	State      bool
}

The server struct holds all the information about a Voldermort server

type Servermetrics

type Servermetrics struct {
	Servers []*SMetric
}

type VoldemortConn

type VoldemortConn struct {
	GetMetrics metrics.Timer
	PutMetrics metrics.Timer
	// contains filtered or unexported fields
}

The VoldemortConn struct is used to hold all the data for the Voldemort cluster you need to query

func Dial

func Dial(raddr *net.TCPAddr, proto string, reg metrics.Registry) (c *VoldemortConn, err error)

Returns a VoldemortConn that can be used to talk to a Voldemort cluster

func (*VoldemortConn) Close

func (conn *VoldemortConn) Close()

func (*VoldemortConn) Do

func (conn *VoldemortConn) Do(input []byte) (output []byte, err error)

creates the voldemort request <4 byte length, big endian encoded><message bytes> and receives the same

func (*VoldemortConn) Get

func (conn *VoldemortConn) Get(store string, key string) (value string, err error)

Nice getter for a string key returning a string value

func (*VoldemortConn) Metrics

func (vc *VoldemortConn) Metrics() (reg metrics.Registry)

func (*VoldemortConn) Put

func (conn *VoldemortConn) Put(store string, key string, value string) (b bool, err error)

func (*VoldemortConn) Server

func (vc *VoldemortConn) Server() (name string)

type VoldemortPool

type VoldemortPool struct {
	Metrics metrics.Registry
	// contains filtered or unexported fields
}

func NewPool

func NewPool(bserver *net.TCPAddr, proto string, pool_timeout time.Duration, conn_count int) (*VoldemortPool, error)

func (*VoldemortPool) Empty

func (vp *VoldemortPool) Empty()

func (*VoldemortPool) GetConn

func (vp *VoldemortPool) GetConn() (vc *VoldemortConn, err error)

Get a VoldemortConn struct from the channel and return it

func (*VoldemortPool) Metricdata

func (vp *VoldemortPool) Metricdata() (Ss *Servermetrics)

func (*VoldemortPool) ReleaseConn

func (vp *VoldemortPool) ReleaseConn(vc *VoldemortConn, state bool)

Jump to

Keyboard shortcuts

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