raft_model

package
v0.0.0-...-d7efa00 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestActions = map[string]string{
		"stats":        "/stats",
		"join":         "/join",
		"leave":        "/leave",
		"payload":      "/payload",
		"send-join":    "/send/join",
		"send-leave":   "/send/leave",
		"send-payload": "/send/payload",
	}
)

Functions

func NewSnapshotNoop

func NewSnapshotNoop() (raft.FSMSnapshot, error)

NewSnapshotNoop is returned by an FSM in response to a SnapshotNoop It must be safe to invoke FSMSnapshot methods with concurrent calls to Apply.

Types

type ApplyResponse

type ApplyResponse struct {
	Error error
	Data  interface{}
}

ApplyResponse response from Apply raft

type CommandPayload

type CommandPayload struct {
	Operation string
	Key       string
	Value     interface{}
}

CommandPayload is payload sent by system when calling raft.Apply(cmd []byte, timeout time.Duration)

type NodeMembershipRequest

type NodeMembershipRequest struct {
	NodeID      string `json:"node_id"`
	RaftAddress string `json:"raft_address"`
}

func (*NodeMembershipRequest) Marshal

func (req *NodeMembershipRequest) Marshal() ([]byte, error)

func (*NodeMembershipRequest) Unmarshal

func (req *NodeMembershipRequest) Unmarshal(reqBody []byte) error

type RpcRequest

type RpcRequest struct {
	ID     string
	Action string
	Body   []byte
	Err    error
}

type SendTo

type SendTo struct {
	ConnectionString string
	Payload          []byte
}

func (*SendTo) Marshal

func (n *SendTo) Marshal() ([]byte, error)

func (*SendTo) Unmarshal

func (n *SendTo) Unmarshal(nodeBody []byte) error

type ServerResponse

type ServerResponse struct {
	Message string
	Data    interface{}
	ErrCode int
	Error   error
}

type SnapshotNoop

type SnapshotNoop struct{}

snapshotNoop handle noop snapshot

func (SnapshotNoop) Persist

func (s SnapshotNoop) Persist(_ raft.SnapshotSink) error

Persist persist to disk. Return nil on success, otherwise return error.

func (SnapshotNoop) Release

func (s SnapshotNoop) Release()

Release release the lock after persist snapshot. Release is invoked when we are finished with the snapshot.

Jump to

Keyboard shortcuts

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