fsm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIntType

func IsIntType(k reflect.Kind) (size int, okay bool)

IsIntType returns whether the passed type is a type of int and the number of bytes needed to encode the type.

Types

type FSM

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

FSM implements a finite state machine used with Raft to provide strong consistency.

func New

func New(args ...interface{}) (*FSM, error)

New returns a new FSM instance.

func (*FSM) Apply

func (c *FSM) Apply(l *raft.Log) interface{}

func (*FSM) Restore

func (c *FSM) Restore(old io.ReadCloser) error

func (*FSM) Snapshot

func (c *FSM) Snapshot() (raft.FSMSnapshot, error)

func (*FSM) State

func (c *FSM) State() *Store

State is used to return a handle to the current state

type IndexEntry

type IndexEntry struct {
	Key   string
	Value uint64
}

IndexEntry keeps a record of the last index per-table.

type IntFieldIndex

type IntFieldIndex struct {
	Field string
}

IntFieldIndex is used to extract a int field from an object using reflection and builds an index on that field.

func (*IntFieldIndex) FromArgs

func (u *IntFieldIndex) FromArgs(args ...interface{}) ([]byte, error)

func (*IntFieldIndex) FromObject

func (u *IntFieldIndex) FromObject(obj interface{}) (bool, []byte, error)

type NodeID

type NodeID int32

type Restore

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

Restore is used to manage restoring a large amount of data into the state store. It works by doing all the restores inside of a single transaction.

func (*Restore) Abort

func (s *Restore) Abort()

Abort abandons the changes made by a restore.

func (*Restore) Commit

func (s *Restore) Commit()

Commit commits the changes made by a restore.

type Snapshot

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

Snapshot is used to provide a point-in-time snapshot. It works by startinga read transaction against the whole state store.

func (*Snapshot) Close

func (s *Snapshot) Close()

Close performs cleanup of a state snapshot.

func (*Snapshot) LastIndex

func (s *Snapshot) LastIndex() uint64

LastIndex returns the last index that affects the snapshotted data.

type Store

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

func NewStore

func NewStore(args ...interface{}) (*Store, error)

func (*Store) Abandon

func (s *Store) Abandon()

Abandon is used to signal that the given state store has been abandoned. Calling this more than one time will panic.

func (*Store) AbandonCh

func (s *Store) AbandonCh() <-chan struct{}

AbandonCh returns a channel you can wait on to know if the state store was abandoned.

func (*Store) DeleteGroup

func (s *Store) DeleteGroup(idx uint64, group string) error

DeleteGroup is used to delete groups.

func (*Store) DeleteNode

func (s *Store) DeleteNode(idx uint64, id int32) error

DeleteNode is used to delete nodes.

func (*Store) DeletePartition

func (s *Store) DeletePartition(idx uint64, topic string, partition int32) error

DeletePartition is used to delete partitions.

func (*Store) DeleteTopic

func (s *Store) DeleteTopic(idx uint64, id string) error

DeleteTopic is used to delete topics.

func (*Store) EnsureGroup

func (s *Store) EnsureGroup(idx uint64, group *structs.Group) error

func (*Store) EnsureNode

func (s *Store) EnsureNode(idx uint64, node *structs.Node) error

EnsureNode is used to upsert nodes.

func (*Store) EnsurePartition

func (s *Store) EnsurePartition(idx uint64, partition *structs.Partition) error

func (*Store) EnsureRegistration

func (s *Store) EnsureRegistration(idx uint64, req *structs.RegisterNodeRequest) error

func (*Store) EnsureTopic

func (s *Store) EnsureTopic(idx uint64, topic *structs.Topic) error

func (*Store) GetGroup

func (s *Store) GetGroup(id string) (uint64, *structs.Group, error)

GetGroup is used to get groups.

func (*Store) GetGroups

func (s *Store) GetGroups() (uint64, []*structs.Group, error)

func (*Store) GetGroupsByCoordinator

func (s *Store) GetGroupsByCoordinator(coordinator int32) (uint64, []*structs.Group, error)

GetGroupsByCoordinator looks up groups with the given coordinator.

func (*Store) GetNode

func (s *Store) GetNode(id int32) (uint64, *structs.Node, error)

GetNode is used to retrieve a node by node name ID.

func (*Store) GetNodes

func (s *Store) GetNodes() (uint64, []*structs.Node, error)

func (*Store) GetPartition

func (s *Store) GetPartition(topic string, id int32) (uint64, *structs.Partition, error)

GetPartition is used to get partitions.

func (*Store) GetPartitions

func (s *Store) GetPartitions() (uint64, []*structs.Partition, error)

func (*Store) GetTopic

func (s *Store) GetTopic(id string) (uint64, *structs.Topic, error)

GetTopic is used to get topics.

func (*Store) GetTopics

func (s *Store) GetTopics() (uint64, []*structs.Topic, error)

func (*Store) PartitionsByLeader

func (s *Store) PartitionsByLeader(leader int32) (uint64, []*structs.Partition, error)

PartitionsByLeader is used to return all partitions for the given leader.

func (*Store) Restore

func (s *Store) Restore() *Restore

func (*Store) Snapshot

func (s *Store) Snapshot() *Snapshot

type Tracer

type Tracer opentracing.Tracer

Jump to

Keyboard shortcuts

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