quorum

package
v2.0.0-...-acbaf60 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartBeatPeriodInSeconds  = 5
	HeartBeatTimeoutInSeconds = HeartBeatPeriodInSeconds * 3
	HeartBeatPeriod           = time.Second * HeartBeatPeriodInSeconds
)
View Source
const (
	PromoteMaster = 0
	DescendMaster = 1
)
View Source
const (
	STATUS_LOOKASIDE int = iota
	STATUS_COMPETE_MASTER
	STATUS_MASTER
	STATUS_FOLLOW
	STATUS_SESSION_CLOSE
)
View Source
const (
	QUORUM_COLLECTION string = "election"
)

Variables

View Source
var MasterPromotionNotifier chan bool

become or lost master status notifier

Functions

func AlwaysMaster

func AlwaysMaster()

func BecomeMaster

func BecomeMaster(uri string, db string) error

func IsMaster

func IsMaster() bool

func UseElectionObjectId

func UseElectionObjectId(electionId primitive.ObjectID)

Types

type ElectionEntry

type ElectionEntry struct {
	ObjectId  primitive.ObjectID `bson:"_id"`
	PID       int                `bson:"pid"`
	Host      string             `bson:"host"`
	Heartbeat int64              `bson:"heartbeat"`
}

Jump to

Keyboard shortcuts

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