singlepaxos

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

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 24 Imported by: 0

README

A Go implementation of a single-decree Paxos

The purpose of this implementation of Paxos is to use it as a system under test for model-based testing with Coloured Petri Nets (CPNs)

Main structure of the implementation of Paxos and test adapter:

1. reader folder has the code that can be used to reade test cases in XML format for testing the implementation.
2. xml/testcases folder has all test cases generated by CPNs tool which can be used to test the implementation,
3. under singlepaxos folder, there are the code of the implementation of Paxos and the code of the tester of the test adapter.

RUN Tests:

a. unit tests:
  1. run shell script qfunitests.sh to perform all unit tests.
  2. run shell script qfcoverage.sh to get statement coverage of unit tests.
b. system tests:
  1. run shell script systemtest.sh to test the whole Paxos system.
  2. run shell script systemcoverage.sh to test the whole Paxos system and get statement coverage results.
All testing results will be generated under a results folder.

Documentation

Overview

Package singlepaxos is a generated protocol buffer package.

It is generated from these files:

singlepaxos.proto

It has these top-level messages:

Heartbeat
Round
Value
Response
PrepareMsg
PromiseMsg
AcceptMsg
LearnMsg
Empty

Index

Constants

View Source
const (
	NoRound uint32 = 0
	Ignore  uint32 = 0
)

Initial values in each replica.

View Source
const LevelNotSet = -1

LevelNotSet is the zero value level used to indicate that no level (and thereby no reply) has been set for a correctable quorum call.

Variables

View Source
var (
	LeaderChan          = make(chan *Node, 8)
	FailurePhaseOneChan = make(chan bool, 8)
	FailurePhaseTwoChan = make(chan bool, 8)
	SuccessPhaseChan    = make(chan int, 8)
)
View Source
var (
	ErrInvalidLengthSinglepaxos = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSinglepaxos   = fmt.Errorf("proto: integer overflow")
)
View Source
var Error = func(n1, n2 *Node) bool {
	if n1.lastErr != nil && n2.lastErr == nil {
		return false
	}
	return true
}

Error sorts nodes by their LastErr() status in increasing order. A node with LastErr() != nil is larger than a node with LastErr() == nil.

View Source
var ID = func(n1, n2 *Node) bool {
	return n1.id < n2.id
}

ID sorts nodes by their identifier in increasing order.

View Source
var Latency = func(n1, n2 *Node) bool {
	if n1.latency < 0 {
		return false
	}
	return n1.latency < n2.latency

}

Latency sorts nodes by latency in increasing order. Latencies less then zero (sentinel value) are considered greater than any positive latency.

View Source
var Port = func(n1, n2 *Node) bool {
	p1, _ := strconv.Atoi(n1.Port())
	p2, _ := strconv.Atoi(n2.Port())
	return p1 < p2
}

ID sorts nodes by their identifier in increasing order.

View Source
var ZeroValue = &Value{}

Functions

func Equal

func Equal(a, b *Configuration) bool

Equal returns a boolean reporting whether a and b represents the same configuration.

func ManagerCreationError

func ManagerCreationError(err error) error

ManagerCreationError returns an error reporting that a Manager could not be created due to err.

func NewFailureDetector

func NewFailureDetector(c Configuration, sr SuspectRestorer, myNode *Node, delta time.Duration) *failureDetector

func RegisterSinglePaxosServer

func RegisterSinglePaxosServer(s *grpc.Server, srv SinglePaxosServer)

func ServerStart

func ServerStart(port int, addrs []string, quorumSize int)

ServerStart setups the server connection and starts it

Types

type AcceptMsg

type AcceptMsg struct {
	Rnd uint32 `protobuf:"varint,1,opt,name=rnd,proto3" json:"rnd,omitempty"`
	Val *Value `protobuf:"bytes,2,opt,name=val" json:"val,omitempty"`
}

AcceptMsg is sent by the Proposer, asking the Acceptors to lock-in the value, val. If AcceptMsg.rnd < Acceptor.rnd, the message will be ignored.

func (*AcceptMsg) Descriptor

func (*AcceptMsg) Descriptor() ([]byte, []int)

func (*AcceptMsg) Equal

func (this *AcceptMsg) Equal(that interface{}) bool

func (*AcceptMsg) GetRnd

func (m *AcceptMsg) GetRnd() uint32

func (*AcceptMsg) GetVal

func (m *AcceptMsg) GetVal() *Value

func (*AcceptMsg) Marshal

func (m *AcceptMsg) Marshal() (dAtA []byte, err error)

func (*AcceptMsg) MarshalTo

func (m *AcceptMsg) MarshalTo(dAtA []byte) (int, error)

func (*AcceptMsg) ProtoMessage

func (*AcceptMsg) ProtoMessage()

func (*AcceptMsg) Reset

func (m *AcceptMsg) Reset()

func (*AcceptMsg) Size

func (m *AcceptMsg) Size() (n int)

func (*AcceptMsg) String

func (this *AcceptMsg) String() string

func (*AcceptMsg) Unmarshal

func (m *AcceptMsg) Unmarshal(dAtA []byte) error

type Acceptor

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

Acceptor represents an acceptor

func NewAcceptor

func NewAcceptor() *Acceptor

NewAcceptor returns a new single-decree Paxos acceptor.

type AdapterConnector

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

func NewAdapterConnector

func NewAdapterConnector(leaderChanOut chan *Node, successChanOut chan int) *AdapterConnector

type ConfigNotFoundError

type ConfigNotFoundError uint32

A ConfigNotFoundError reports that a specified configuration could not be found.

func (ConfigNotFoundError) Error

func (e ConfigNotFoundError) Error() string

type Configuration

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

A Configuration represents a static set of nodes on which quorum remote procedure calls may be invoked.

func (*Configuration) Accept

func (c *Configuration) Accept(ctx context.Context, a *AcceptMsg) (resp *LearnMsg, err error)

Accept is invoked as a quorum call on all nodes in configuration c, using the same argument arg, and returns the result.

func (*Configuration) ClientHandle

func (c *Configuration) ClientHandle(ctx context.Context, a *Value) (resp *Response, err error)

ClientHandle is invoked as a quorum call on all nodes in configuration c, using the same argument arg, and returns the result.

func (*Configuration) Commit

func (c *Configuration) Commit(ctx context.Context, a *LearnMsg) (resp *Empty, err error)

Commit is invoked as a quorum call on all nodes in configuration c, using the same argument arg, and returns the result.

func (*Configuration) ID

func (c *Configuration) ID() uint32

ID reports the identifier for the configuration.

func (*Configuration) NodeIDs

func (c *Configuration) NodeIDs() []uint32

NodeIDs returns a slice containing the local ids of all the nodes in the configuration. IDs are returned in the same order as they were provided in the creation of the Configuration.

func (*Configuration) Nodes

func (c *Configuration) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Configuration.

func (*Configuration) Prepare

func (c *Configuration) Prepare(ctx context.Context, a *PrepareMsg) (resp *PromiseMsg, err error)

Prepare is invoked as a quorum call on all nodes in configuration c, using the same argument arg, and returns the result.

func (*Configuration) Size

func (c *Configuration) Size() int

Size returns the number of nodes in the configuration.

func (*Configuration) String

func (c *Configuration) String() string

func (*Configuration) SubError

func (c *Configuration) SubError() <-chan GRPCError

SubError returns a channel for listening to individual node errors. Currently only a single listener is supported.

type Empty

type Empty struct {
}

func (*Empty) Descriptor

func (*Empty) Descriptor() ([]byte, []int)

func (*Empty) Equal

func (this *Empty) Equal(that interface{}) bool

func (*Empty) Marshal

func (m *Empty) Marshal() (dAtA []byte, err error)

func (*Empty) MarshalTo

func (m *Empty) MarshalTo(dAtA []byte) (int, error)

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) Size

func (m *Empty) Size() (n int)

func (*Empty) String

func (this *Empty) String() string

func (*Empty) Unmarshal

func (m *Empty) Unmarshal(dAtA []byte) error

type GRPCError

type GRPCError struct {
	NodeID uint32
	Cause  error
}

GRPCError is used to report that a single gRPC call failed.

func (GRPCError) Error

func (e GRPCError) Error() string

type Heartbeat

type Heartbeat struct {
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*Heartbeat) Descriptor

func (*Heartbeat) Descriptor() ([]byte, []int)

func (*Heartbeat) Equal

func (this *Heartbeat) Equal(that interface{}) bool

func (*Heartbeat) GetId

func (m *Heartbeat) GetId() uint32

func (*Heartbeat) Marshal

func (m *Heartbeat) Marshal() (dAtA []byte, err error)

func (*Heartbeat) MarshalTo

func (m *Heartbeat) MarshalTo(dAtA []byte) (int, error)

func (*Heartbeat) ProtoMessage

func (*Heartbeat) ProtoMessage()

func (*Heartbeat) Reset

func (m *Heartbeat) Reset()

func (*Heartbeat) Size

func (m *Heartbeat) Size() (n int)

func (*Heartbeat) String

func (this *Heartbeat) String() string

func (*Heartbeat) Unmarshal

func (m *Heartbeat) Unmarshal(dAtA []byte) error

type IllegalConfigError

type IllegalConfigError string

An IllegalConfigError reports that a specified configuration could not be created.

func (IllegalConfigError) Error

func (e IllegalConfigError) Error() string

type LeaderDetector

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

LeaderDetector

func NewLeaderDetector

func NewLeaderDetector(c Configuration, myNode *Node, delay time.Duration) *LeaderDetector

func (*LeaderDetector) Restore

func (ld *LeaderDetector) Restore(node *Node)

Restore notifies the LeaderDetector that the given previously suspected node, is no longer suspected.

func (*LeaderDetector) Subscribe

func (ld *LeaderDetector) Subscribe() <-chan *Node

Subscribe returns a buffered channel on which leader changes are published.

func (*LeaderDetector) Suspect

func (ld *LeaderDetector) Suspect(node *Node)

Suspect notifies the LeaderDetector that the given node is suspected to have failued.

type LearnMsg

type LearnMsg struct {
	Rnd uint32 `protobuf:"varint,1,opt,name=rnd,proto3" json:"rnd,omitempty"`
	Val *Value `protobuf:"bytes,2,opt,name=val" json:"val,omitempty"`
}

LearnMsg is sent by an Acceptor to the Proposer, if the Acceptor agreed to lock-in the value, val. The LearnMsg is also sent by the Proposer in a Commit.

func (*LearnMsg) Descriptor

func (*LearnMsg) Descriptor() ([]byte, []int)

func (*LearnMsg) Equal

func (this *LearnMsg) Equal(that interface{}) bool

func (*LearnMsg) GetRnd

func (m *LearnMsg) GetRnd() uint32

func (*LearnMsg) GetVal

func (m *LearnMsg) GetVal() *Value

func (*LearnMsg) Marshal

func (m *LearnMsg) Marshal() (dAtA []byte, err error)

func (*LearnMsg) MarshalTo

func (m *LearnMsg) MarshalTo(dAtA []byte) (int, error)

func (*LearnMsg) ProtoMessage

func (*LearnMsg) ProtoMessage()

func (*LearnMsg) Reset

func (m *LearnMsg) Reset()

func (*LearnMsg) Size

func (m *LearnMsg) Size() (n int)

func (*LearnMsg) String

func (this *LearnMsg) String() string

func (*LearnMsg) Unmarshal

func (m *LearnMsg) Unmarshal(dAtA []byte) error

type Manager

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

Manager manages a pool of node configurations on which quorum remote procedure calls can be made.

func NewManager

func NewManager(nodeAddrs []string, opts ...ManagerOption) (*Manager, error)

NewManager attempts to connect to the given set of node addresses and if successful returns a new Manager containing connections to those nodes.

func (*Manager) AddNode

func (m *Manager) AddNode(addr string) error

AddNode attempts to dial to the provide node address. The node is added to the Manager's pool of nodes if a connection was established.

func (*Manager) Close

func (m *Manager) Close()

Close closes all node connections and any client streams.

func (*Manager) Configuration

func (m *Manager) Configuration(id uint32) (config *Configuration, found bool)

Configuration returns the configuration with the given global identifier if present.

func (*Manager) ConfigurationIDs

func (m *Manager) ConfigurationIDs() []uint32

ConfigurationIDs returns the identifier of each available configuration.

func (*Manager) Configurations

func (m *Manager) Configurations() []*Configuration

Configurations returns a slice of each available configuration.

func (*Manager) NewConfiguration

func (m *Manager) NewConfiguration(ids []uint32, qspec QuorumSpec) (*Configuration, error)

NewConfiguration returns a new configuration given quorum specification and a timeout.

func (*Manager) Node

func (m *Manager) Node(id uint32) (node *Node, found bool)

Node returns the node with the given identifier if present.

func (*Manager) NodeIDs

func (m *Manager) NodeIDs() []uint32

NodeIDs returns the identifier of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

func (*Manager) Nodes

func (m *Manager) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

func (*Manager) Size

func (m *Manager) Size() (nodes, configs int)

Size returns the number of nodes and configurations in the Manager.

type ManagerOption

type ManagerOption func(*managerOptions)

ManagerOption provides a way to set different options on a new Manager.

func WithGrpcDialOptions

func WithGrpcDialOptions(opts ...grpc.DialOption) ManagerOption

WithGrpcDialOptions returns a ManagerOption which sets any gRPC dial options the Manager should use when initially connecting to each node in its pool.

func WithLogger

func WithLogger(logger *log.Logger) ManagerOption

WithLogger returns a ManagerOption which sets an optional error logger for the Manager.

func WithNoConnect

func WithNoConnect() ManagerOption

WithNoConnect returns a ManagerOption which instructs the Manager not to connect to any of its nodes. Mainly used for testing purposes.

func WithTracing

func WithTracing() ManagerOption

WithTracing controls whether to trace qourum calls for this Manager instance using the golang.org/x/net/trace package. Tracing is currently only supported for regular quorum calls.

type MultiSorter

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

MultiSorter implements the Sort interface, sorting the nodes within.

func OrderedBy

func OrderedBy(less ...lessFunc) *MultiSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

func (*MultiSorter) Len

func (ms *MultiSorter) Len() int

Len is part of sort.Interface.

func (*MultiSorter) Less

func (ms *MultiSorter) Less(i, j int) bool

Less is part of sort.Interface. It is implemented by looping along the less functions until it finds a comparison that is either Less or !Less. Note that it can call the less functions twice per call. We could change the functions to return -1, 0, 1 and reduce the number of calls for greater efficiency: an exercise for the reader.

func (*MultiSorter) Sort

func (ms *MultiSorter) Sort(nodes []*Node)

Sort sorts the argument slice according to the less functions passed to OrderedBy.

func (*MultiSorter) Swap

func (ms *MultiSorter) Swap(i, j int)

Swap is part of sort.Interface.

type Node

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

Node encapsulates the state of a node on which a remote procedure call can be made.

func (*Node) Address

func (n *Node) Address() string

Address returns network address of n.

func (*Node) FullString

func (n *Node) FullString() string

func (*Node) ID

func (n *Node) ID() uint32

ID returns the ID of n.

func (*Node) LastErr

func (n *Node) LastErr() error

LastErr returns the last error encountered (if any) when invoking a remote procedure call on this node.

func (*Node) Latency

func (n *Node) Latency() time.Duration

Latency returns the latency of the last successful remote procedure call made to this node.

func (*Node) Port

func (n *Node) Port() string

Port returns network port of n.

func (*Node) String

func (n *Node) String() string

type NodeNotFoundError

type NodeNotFoundError uint32

A NodeNotFoundError reports that a specified node could not be found.

func (NodeNotFoundError) Error

func (e NodeNotFoundError) Error() string

type PaxosQSpec

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

PaxosQSpec is a quorum specification object for Paxos. It only holds the quorum size.

func (PaxosQSpec) AcceptQF

func (qs PaxosQSpec) AcceptQF(replies []*LearnMsg) (*LearnMsg, bool)

AcceptQF is the quorum function for the Accept quorum call method. This is where the Proposer handle LearnMsgs to determine if a value has been decided by the Acceptors. The quorum function returns true if a value has been decided, and the corresponding LearnMsg holds the round number and value that was decided. If false is returned, no value was decided.

func (PaxosQSpec) ClientHandleQF

func (qs PaxosQSpec) ClientHandleQF(replies []*Response) (*Response, bool)

func (PaxosQSpec) CommitQF

func (qs PaxosQSpec) CommitQF(replies []*Empty) (*Empty, bool)

CommitQF is the quorum function for the Commit quorum call method. This function just waits for a quorum of empty replies, indicating that at least a quorum of Learners have committed the value decided by the Acceptors.

func (PaxosQSpec) PrepareQF

func (qs PaxosQSpec) PrepareQF(prepare *PrepareMsg, replies []*PromiseMsg) (*PromiseMsg, bool)

PrepareQF is the quorum function for the Prepare quorum call method. This is where the Proposer handle PromiseMsgs returned by the Acceptors to determine if a value from a previous round needs to be considered.

type PaxosReplica

type PaxosReplica struct {
	SinglePaxosServer
	*Acceptor
	*Proposer
	// contains filtered or unexported fields
}

PaxosReplica is the structure composing the Proposer, Acceptor, and Learner.

func NewPaxosReplica

func NewPaxosReplica(port int, config *Configuration) *PaxosReplica

NewPaxosReplica returns a new Paxos replica with a configuration as provided by the input addrs. This replica will run on the given port.

func (*PaxosReplica) Accept

func (r *PaxosReplica) Accept(ctx context.Context, accMsg *AcceptMsg) (*LearnMsg, error)

Accept handles the accept quorum calls from the proposer by passing the received messages to its acceptor. It receives Accept massages and pass them to handleAccept method of acceptor. It returns learn massages back to the proposer by its acceptor

func (*PaxosReplica) ClientHandle

func (r *PaxosReplica) ClientHandle(ctx context.Context, req *Value) (rsp *Response, err error)

func (*PaxosReplica) Commit

func (r *PaxosReplica) Commit(ctx context.Context, lrnMsg *LearnMsg) (*Empty, error)

Commit handles the commit quorum calls from the proposer. It receives a learn massage from proposer and deliver its decided value to . It returns a empty massage back.

func (*PaxosReplica) Ping

func (r *PaxosReplica) Ping(ctx context.Context, hb *Heartbeat) (*Heartbeat, error)

Ping just replies with the same heartbeat message.

func (*PaxosReplica) Prepare

func (r *PaxosReplica) Prepare(ctx context.Context, prepMsg *PrepareMsg) (*PromiseMsg, error)

Prepare handles the prepare quorum calls from the proposer by passing the received messages to its acceptor. It receives prepare massages and pass them to handlePrepare method of acceptor. It returns promise messages back to the proposer by its acceptor.

type PrepareMsg

type PrepareMsg struct {
	Rnd uint32 `protobuf:"varint,1,opt,name=rnd,proto3" json:"rnd,omitempty"`
}

PrepareMsg is sent by the Proposer to start a new round, rnd.

func (*PrepareMsg) Descriptor

func (*PrepareMsg) Descriptor() ([]byte, []int)

func (*PrepareMsg) Equal

func (this *PrepareMsg) Equal(that interface{}) bool

func (*PrepareMsg) GetRnd

func (m *PrepareMsg) GetRnd() uint32

func (*PrepareMsg) Marshal

func (m *PrepareMsg) Marshal() (dAtA []byte, err error)

func (*PrepareMsg) MarshalTo

func (m *PrepareMsg) MarshalTo(dAtA []byte) (int, error)

func (*PrepareMsg) ProtoMessage

func (*PrepareMsg) ProtoMessage()

func (*PrepareMsg) Reset

func (m *PrepareMsg) Reset()

func (*PrepareMsg) Size

func (m *PrepareMsg) Size() (n int)

func (*PrepareMsg) String

func (this *PrepareMsg) String() string

func (*PrepareMsg) Unmarshal

func (m *PrepareMsg) Unmarshal(dAtA []byte) error

type PromiseMsg

type PromiseMsg struct {
	Rnd  uint32 `protobuf:"varint,1,opt,name=rnd,proto3" json:"rnd,omitempty"`
	Vrnd uint32 `protobuf:"varint,2,opt,name=vrnd,proto3" json:"vrnd,omitempty"`
	Vval *Value `protobuf:"bytes,3,opt,name=vval" json:"vval,omitempty"`
}

PromiseMsg is the reply from an Acceptor to the Proposer in response to a PrepareMsg. The Acceptor will only respond if the PrepareMsg.rnd > Acceptor.rnd.

func (*PromiseMsg) Descriptor

func (*PromiseMsg) Descriptor() ([]byte, []int)

func (*PromiseMsg) Equal

func (this *PromiseMsg) Equal(that interface{}) bool

func (*PromiseMsg) GetRnd

func (m *PromiseMsg) GetRnd() uint32

func (*PromiseMsg) GetVrnd

func (m *PromiseMsg) GetVrnd() uint32

func (*PromiseMsg) GetVval

func (m *PromiseMsg) GetVval() *Value

func (*PromiseMsg) Marshal

func (m *PromiseMsg) Marshal() (dAtA []byte, err error)

func (*PromiseMsg) MarshalTo

func (m *PromiseMsg) MarshalTo(dAtA []byte) (int, error)

func (*PromiseMsg) ProtoMessage

func (*PromiseMsg) ProtoMessage()

func (*PromiseMsg) Reset

func (m *PromiseMsg) Reset()

func (*PromiseMsg) Size

func (m *PromiseMsg) Size() (n int)

func (*PromiseMsg) String

func (this *PromiseMsg) String() string

func (*PromiseMsg) Unmarshal

func (m *PromiseMsg) Unmarshal(dAtA []byte) error

type Proposer

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

Proposer represents the state of a single-decree Paxos proposer.

func NewProposer

func NewProposer(c *Configuration, port int) *Proposer

NewProposer returns a new single-decree Paxos proposer.

func (*Proposer) ProposeClientValue

func (p *Proposer) ProposeClientValue(cval *Value)

DeliverClientValue delivers client value cval to proposer.

func (*Proposer) Start

func (p *Proposer) Start()

func (*Proposer) Stop

func (p *Proposer) Stop()

Stop stops p's main run loop.

type QuorumCallError

type QuorumCallError struct {
	Reason     string
	ReplyCount int
	Errors     []GRPCError
}

A QuorumCallError is used to report that a quorum call failed.

func (QuorumCallError) Error

func (e QuorumCallError) Error() string

type QuorumSpec

type QuorumSpec interface {
	// AcceptQF is the quorum function for the Accept
	// quorum call method.
	AcceptQF(replies []*LearnMsg) (*LearnMsg, bool)

	// ClientHandleQF is the quorum function for the ClientHandle
	// quorum call method.
	ClientHandleQF(replies []*Response) (*Response, bool)

	// CommitQF is the quorum function for the Commit
	// quorum call method.
	CommitQF(replies []*Empty) (*Empty, bool)

	// PrepareQF is the quorum function for the Prepare
	// quorum call method.
	PrepareQF(req *PrepareMsg, replies []*PromiseMsg) (*PromiseMsg, bool)
}

QuorumSpec is the interface that wraps every quorum function.

func NewPaxosQSpec

func NewPaxosQSpec(quorumSize int) QuorumSpec

NewPaxosQSpec returns a quorum specification object for Paxos for the given quorum size.

type Response

type Response struct {
	ClientResponse string `protobuf:"bytes,1,opt,name=clientResponse,proto3" json:"clientResponse,omitempty"`
}

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) Equal

func (this *Response) Equal(that interface{}) bool

func (*Response) GetClientResponse

func (m *Response) GetClientResponse() string

func (*Response) Marshal

func (m *Response) Marshal() (dAtA []byte, err error)

func (*Response) MarshalTo

func (m *Response) MarshalTo(dAtA []byte) (int, error)

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) Size

func (m *Response) Size() (n int)

func (*Response) String

func (this *Response) String() string

func (*Response) Unmarshal

func (m *Response) Unmarshal(dAtA []byte) error

type Restorer

type Restorer interface {
	Restore(node *Node)
}

Restorer is the interface that wraps the Restore method. Restore indicates that the node with identifier id should be considered restored.

type Round

type Round struct {
	Rnd uint32 `protobuf:"varint,1,opt,name=rnd,proto3" json:"rnd,omitempty"`
}

func (*Round) Descriptor

func (*Round) Descriptor() ([]byte, []int)

func (*Round) Equal

func (this *Round) Equal(that interface{}) bool

func (*Round) GetRnd

func (m *Round) GetRnd() uint32

func (*Round) Marshal

func (m *Round) Marshal() (dAtA []byte, err error)

func (*Round) MarshalTo

func (m *Round) MarshalTo(dAtA []byte) (int, error)

func (*Round) ProtoMessage

func (*Round) ProtoMessage()

func (*Round) Reset

func (m *Round) Reset()

func (*Round) Size

func (m *Round) Size() (n int)

func (*Round) String

func (this *Round) String() string

func (*Round) Unmarshal

func (m *Round) Unmarshal(dAtA []byte) error

type SinglePaxosClient

type SinglePaxosClient interface {
	Ping(ctx context.Context, in *Heartbeat, opts ...grpc.CallOption) (*Heartbeat, error)
	Prepare(ctx context.Context, in *PrepareMsg, opts ...grpc.CallOption) (*PromiseMsg, error)
	Accept(ctx context.Context, in *AcceptMsg, opts ...grpc.CallOption) (*LearnMsg, error)
	Commit(ctx context.Context, in *LearnMsg, opts ...grpc.CallOption) (*Empty, error)
	ClientHandle(ctx context.Context, in *Value, opts ...grpc.CallOption) (*Response, error)
}

func NewSinglePaxosClient

func NewSinglePaxosClient(cc *grpc.ClientConn) SinglePaxosClient

type SinglePaxosServer

type SinglePaxosServer interface {
	Ping(context.Context, *Heartbeat) (*Heartbeat, error)
	Prepare(context.Context, *PrepareMsg) (*PromiseMsg, error)
	Accept(context.Context, *AcceptMsg) (*LearnMsg, error)
	Commit(context.Context, *LearnMsg) (*Empty, error)
	ClientHandle(context.Context, *Value) (*Response, error)
}

type SuspectRestorer

type SuspectRestorer interface {
	Suspecter
	Restorer
}

SuspectRestorer is the interface that groups the Suspect and Restore methods.

type Suspecter

type Suspecter interface {
	Suspect(node *Node)
}

Suspecter is the interface that wraps the Suspect method. Suspect indicates that the node with identifier id should be considered suspected.

type Value

type Value struct {
	ClientRequest string `protobuf:"bytes,1,opt,name=clientRequest,proto3" json:"clientRequest,omitempty"`
}

func (*Value) Descriptor

func (*Value) Descriptor() ([]byte, []int)

func (*Value) Equal

func (this *Value) Equal(that interface{}) bool

func (*Value) GetClientRequest

func (m *Value) GetClientRequest() string

func (*Value) Marshal

func (m *Value) Marshal() (dAtA []byte, err error)

func (*Value) MarshalTo

func (m *Value) MarshalTo(dAtA []byte) (int, error)

func (*Value) ProtoMessage

func (*Value) ProtoMessage()

func (*Value) Reset

func (m *Value) Reset()

func (*Value) Size

func (m *Value) Size() (n int)

func (*Value) String

func (this *Value) String() string

func (*Value) Unmarshal

func (m *Value) Unmarshal(dAtA []byte) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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