gpaxos

package module
v0.0.0-...-feddf00 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2018 License: MIT Imports: 3 Imported by: 0

README

gpaxos

Go Paxos library,inspired by tencent wechat phxpaxos project(see github.com/tencent-wechat/phxpaxos)

Documentation

Index

Constants

View Source
const (
	SYSTEM_V_SMID      = 100000000
	MASTER_V_SMID      = 100000001
	BATCH_PROPOSE_SMID = 100000002
)

Variables

View Source
var (
	PaxosTryCommitRet_OK                          = errors.New("PaxosTryCommitRet_OK")
	PaxosTryCommitRet_Reject                      = errors.New("PaxosTryCommitRet_Reject")
	PaxosTryCommitRet_Conflict                    = errors.New("PaxosTryCommitRet_Conflict")
	PaxosTryCommitRet_ExecuteFail                 = errors.New("PaxosTryCommitRet_ExecuteFail")
	PaxosTryCommitRet_Follower_Cannot_Commit      = errors.New("PaxosTryCommitRet_Follower_Cannot_Commit")
	PaxosTryCommitRet_Im_Not_In_Membership        = errors.New("PaxosTryCommitRet_Im_Not_In_Membership")
	PaxosTryCommitRet_Value_Size_TooLarge         = errors.New("PaxosTryCommitRet_Value_Size_TooLarge")
	PaxosTryCommitRet_Timeout                     = errors.New("PaxosTryCommitRet_Timeout")
	PaxosTryCommitRet_WaitTimeout                 = errors.New("PaxosTryCommitRet_WaitTimeout")
	PaxosTryCommitRet_TooManyThreadWaiting_Reject = errors.New("PaxosTryCommitRet_TooManyThreadWaiting_Reject")
)
View Source
var (
	Paxos_SystemError                           = errors.New("Paxos_SystemError")
	Paxos_GroupIdxWrong                         = errors.New("Paxos_GroupIdxWrong")
	Paxos_MembershipOp_GidNotSame               = errors.New("Paxos_MembershipOp_GidNotSame")
	Paxos_MembershipOp_VersionConflit           = errors.New("Paxos_MembershipOp_VersionConflit")
	Paxos_MembershipOp_NoGid                    = errors.New("Paxos_MembershipOp_NoGid")
	Paxos_MembershipOp_Add_NodeExist            = errors.New("Paxos_MembershipOp_Add_NodeExist")
	Paxos_MembershipOp_Remove_NodeNotExist      = errors.New("Paxos_MembershipOp_Remove_NodeNotExist")
	Paxos_MembershipOp_Change_NoChange          = errors.New("Paxos_MembershipOp_Change_NoChange")
	Paxos_GetInstanceValue_Value_NotExist       = errors.New("Paxos_GetInstanceValue_Value_NotExist")
	Paxos_GetInstanceValue_Value_Not_Chosen_Yet = errors.New("Paxos_GetInstanceValue_Value_Not_Chosen_Yet")
)

Functions

This section is empty.

Types

type BatchStateMachineContext

type BatchStateMachineContext struct {
	StateMachineContexts []*StateMachineContext
}

func NewBatchStateMachineContext

func NewBatchStateMachineContext() *BatchStateMachineContext

type Node

type Node struct {
	Ip   string
	Port int
	Id   uint64
}

func NewNode

func NewNode(ip string, port int) *Node

func (*Node) String

func (self *Node) String() string

type NodeList

type NodeList []*Node

type Options

type Options struct {
	MyNode *Node

	NodeList []*Node
}

type StateMachine

type StateMachine interface {
	Execute(instanceId uint64, paxosValue []byte, context *StateMachineContext) error

	SMID() int32

	ExecuteForCheckpoint(instanceId uint64, paxosValue []byte) error

	GetCheckpointInstanceID() uint64

	LockCheckpointState() error

	GetCheckpointState(dirPath *string, fileList []string) error

	UnLockCheckpointState()

	LoadCheckpointState(checkpointTmpFileDirPath string,
		fileList []string, checkpointInstanceID uint64) error
}

type StateMachineContext

type StateMachineContext struct {
	SMId    int32
	Context interface{}
}

func NewStateMachineContext

func NewStateMachineContext(smid int32, context interface{}) *StateMachineContext

Directories

Path Synopsis
Package common is a generated protocol buffer package.
Package common is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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