server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterID identifier of cluster. Use only one cluster.
	ClusterID uint64 = 123
)

Variables

This section is empty.

Functions

func NewExampleStateMachine

func NewExampleStateMachine(clusterID uint64,
	nodeID uint64) sm.IStateMachine

Types

type ExampleStateMachine

type ExampleStateMachine struct {
	ClusterID uint64
	NodeID    uint64
	Count     uint64
	Data      []byte
}

func (*ExampleStateMachine) Close

func (s *ExampleStateMachine) Close() error

func (*ExampleStateMachine) Lookup

func (s *ExampleStateMachine) Lookup(query interface{}) (interface{}, error)

func (*ExampleStateMachine) RecoverFromSnapshot

func (s *ExampleStateMachine) RecoverFromSnapshot(
	r io.Reader,
	files []sm.SnapshotFile,
	done <-chan struct{},
) error

RecoverFromSnapshot recovers the state using the provided snapshot.

func (*ExampleStateMachine) SaveSnapshot

func (s *ExampleStateMachine) SaveSnapshot(
	w io.Writer,
	fc sm.ISnapshotFileCollection,
	done <-chan struct{},
) error

func (*ExampleStateMachine) Update

func (s *ExampleStateMachine) Update(data []byte) (sm.Result, error)

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(nodeID int, addr, datadir string, addresses []string, join, isObserver bool) (*Node, error)

func (*Node) AddObserver

func (n *Node) AddObserver(address string, node int) error

func (*Node) GetMembers

func (n *Node) GetMembers() (*dragonboat.Membership, error)

func (*Node) Leader

func (n *Node) Leader() (uint64, bool, error)

func (*Node) NodeID

func (n *Node) NodeID() string

func (*Node) Propose

func (n *Node) Propose(msg string) error

func (*Node) Read

func (n *Node) Read(query string) (string, error)

func (*Node) Start

func (n *Node) Start() error

func (*Node) Start1

func (n *Node) Start1() error

func (*Node) Stop

func (n *Node) Stop()

Jump to

Keyboard shortcuts

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