raftlease

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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, logger Logger) raftlease.NotifyTarget

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

Types

type Logger

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

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.

Jump to

Keyboard shortcuts

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