etcdutil

package
v0.0.0-...-28de2d1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TasksDir   = "tasks"
	NodesDir   = "nodes"
	ConfigDir  = "config"
	FreeDir    = "freeTasks"
	Epoch      = "epoch"
	Status     = "status"
	TaskMaster = "0"
	NodeAddr   = "address"
	NodeTTL    = "ttl"
	Healthy    = "healthy"
)

Variables

This section is empty.

Functions

func CASEpoch

func CASEpoch(client *etcd.Client, appname string, prevEpoch, epoch uint64) error

func DetectFailure

func DetectFailure(client *etcd.Client, name string, stop chan bool) error

detect failure of the given taskID

func EpochPath

func EpochPath(appName string) string

func FreeTaskDir

func FreeTaskDir(appName string) string

func FreeTaskPath

func FreeTaskPath(appName, idStr string) string

func GetAddress

func GetAddress(client *etcd.Client, name string, id uint64) (string, error)

getAddress will return the host:port address of the service taking care of the task that we want to talk to. Currently we grab the information from etcd every time. Local cache could be used. If it failed, e.g. network failure, it should return error.

func GetAndWatchEpoch

func GetAndWatchEpoch(client *etcd.Client, appname string, epochC chan uint64, stop chan bool) (uint64, error)

func HealthyPath

func HealthyPath(appName string) string

func Heartbeat

func Heartbeat(client *etcd.Client, name string, taskID uint64, interval time.Duration, stop chan struct{}) error

heartbeat to etcd cluster until stop

func JobStatusPath

func JobStatusPath(appName string) string

func ListKeys

func ListKeys(nodes []*etcd.Node) []string

func MasterPath

func MasterPath(job string) string

func MetaPath

func MetaPath(appName string, taskID uint64) string

func MustCreate

func MustCreate(c *etcd.Client, logger *log.Logger, key, value string, ttl uint64) *etcd.Response

func ReportFailure

func ReportFailure(client *etcd.Client, name, failedTask string) error

report failure to etcd cluster If a framework detects a failure, it tries to report failure to /FreeTasks/{taskID}

func SetJobStatus

func SetJobStatus(client *etcd.Client, name string, status int) error

func TaskDirPath

func TaskDirPath(appName string) string

func TaskHealthyPath

func TaskHealthyPath(appName string, taskID uint64) string

func TaskMasterPath

func TaskMasterPath(appName string, taskID uint64) string

func TryOccupyTask

func TryOccupyTask(client *etcd.Client, name string, taskID uint64, connection string) (bool, error)

func WaitFreeTask

func WaitFreeTask(client *etcd.Client, name string, logger *log.Logger) (uint64, error)

WaitFreeTask blocks until it gets a hint of free task

func WatchMeta

func WatchMeta(c *etcd.Client, path string, stop chan bool, responseHandler func(*etcd.Response)) error

func WorkerPath

func WorkerPath(job string, id uint64) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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