leader

package
v0.0.0-...-9acc6dc Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2016 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package leader implements leader election between cored processes of a Chain Core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(ctx context.Context) (string, error)

Address retrieves the IP address of the current core leader.

func IsLeading

func IsLeading() bool

IsLeading returns true if this process is the core leader.

func Run

func Run(db *sql.DB, addr string, lead func(context.Context))

Run runs as a goroutine, trying once every five seconds to become the leader for the core. If it succeeds, then it calls the function lead (for generating or fetching blocks, and for expiring reservations) and enters a leadership-keepalive loop.

Function lead is called when the local process becomes the leader. Its context is canceled when the process is deposed as leader.

The Chain Core has up to a 10-second refractory period after shutdown, during which no process can become the new leader.

Types

This section is empty.

Jump to

Keyboard shortcuts

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