rainbond: github.com/goodrain/rainbond/util/etcd/etcdlock Index | Files

package etcdlock

import "github.com/goodrain/rainbond/util/etcd/etcdlock"

Package etcdlock Master election using etcd.


Package Files


type MasterEvent Uses

type MasterEvent struct {
    Type   MasterEventType // event type
    Master string          // identity of the lock holder
    Error  error

MasterEvent represents a single event sent on the events channel.

type MasterEventType Uses

type MasterEventType int

MasterEventType Various event types for the events channel.

const (
    //MasterAdded this node has the lock.
    MasterAdded MasterEventType = iota
    //MasterDeleted MasterDeleted
    //MasterModified MasterModified
    //MasterError MasterError

type MasterInterface Uses

type MasterInterface interface {
    // Start the election and attempt to acquire the lock. If acquired, the
    // lock is refreshed periodically based on the ttl.

    // Stops watching the lock. Closes the events channel.

    // Returns the event channel used by the etcd lock.
    EventsChan() <-chan MasterEvent

    // Method to get the current lockholder. Returns "" if free.
    GetHolder() string

MasterInterface Interface used by the etcd master lock clients.

func CreateMasterLock Uses

func CreateMasterLock(etcdEndpoints []string, election string, prop string, ttl int64) (MasterInterface, error)

CreateMasterLock create master lock

Package etcdlock imports 7 packages (graph). Updated 2018-04-24. Refresh now. Tools for package owners.