This section is empty.


This section is empty.


func LeaseHolders

func LeaseHolders(mongo Mongo, collection, namespace, modelUUID string) (map[string]string, error)

LeaseHolders returns a map of each lease and the holder in the specified namespace and model.

func MakeTrapdoorFunc

func MakeTrapdoorFunc(mongo Mongo, collection string) raftlease.TrapdoorFunc

MakeTrapdoorFunc returns a raftlease.TrapdoorFunc for the specified collection.

func NewNotifyTarget

func NewNotifyTarget(mongo Mongo, collection string, logDest io.Writer, errorLogger Logger) raftlease.NotifyTarget

NewNotifyTarget returns something that can be used to report lease changes.


type Logger

type Logger interface {
	Errorf(string, ...interface{})

Logger allows us to report errors if we can't write to the database for some reason.

type Mongo

type Mongo interface {

	// RunTransaction should probably delegate to a jujutxn.Runner's Run method.
	RunTransaction(jujutxn.TransactionSource) error

	// GetCollection should probably call the mongo.CollectionFromName func.
	GetCollection(name string) (collection mongo.Collection, closer func())

Mongo exposes MongoDB operations for use by the lease package.

Source Files