backend

package
v0.0.0-...-3d827b6 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MasterInfo

type MasterInfo struct {
	MasterID string
	Version  string
	//The time it became a master
	StartedAt time.Time
	//The last successful heartbeat
	LastHeartbeat time.Time
}

type MasterLock

type MasterLock interface {
	// Achieve a lock to become the master. If lock is successful, the provided
	// MasterInfo will be filled out and recorded. The MasterInfo passed in will be filled
	// out with the remaining details.
	Lock(info *MasterInfo) error

	// Release the lock to relinquish the master role. This will not succeed if the
	// provided masterID does not match the ID of the current master.
	UnLock(masterID string) error

	// Write a heartbeat to ensure that the master role is not lost.
	// If successful, the last heartbeat time is written to the passed MasterInfo
	WriteHeartbeat(info *MasterInfo) error

	// Get the current master status. Provides the MasterInfo of the current master.
	Status() (*MasterInfo, error)
}

Directories

Path Synopsis
database initialization functionality
database initialization functionality

Jump to

Keyboard shortcuts

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