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
- Variables
- func Equal(a, b *Configuration) bool
- func ManagerCreationError(err error) error
- func NewFailureDetector(c Configuration, sr SuspectRestorer, myNode *Node, delta time.Duration) *failureDetector
- func RegisterSinglePaxosServer(s *grpc.Server, srv SinglePaxosServer)
- func ServerStart(port int, addrs []string, quorumSize int)
- type AcceptMsg
- func (*AcceptMsg) Descriptor() ([]byte, []int)
- func (this *AcceptMsg) Equal(that interface{}) bool
- func (m *AcceptMsg) GetRnd() uint32
- func (m *AcceptMsg) GetVal() *Value
- func (m *AcceptMsg) Marshal() (dAtA []byte, err error)
- func (m *AcceptMsg) MarshalTo(dAtA []byte) (int, error)
- func (*AcceptMsg) ProtoMessage()
- func (m *AcceptMsg) Reset()
- func (m *AcceptMsg) Size() (n int)
- func (this *AcceptMsg) String() string
- func (m *AcceptMsg) Unmarshal(dAtA []byte) error
- type Acceptor
- type AdapterConnector
- type ConfigNotFoundError
- type Configuration
- func (c *Configuration) Accept(ctx context.Context, a *AcceptMsg) (resp *LearnMsg, err error)
- func (c *Configuration) ClientHandle(ctx context.Context, a *Value) (resp *Response, err error)
- func (c *Configuration) Commit(ctx context.Context, a *LearnMsg) (resp *Empty, err error)
- func (c *Configuration) ID() uint32
- func (c *Configuration) NodeIDs() []uint32
- func (c *Configuration) Nodes() []*Node
- func (c *Configuration) Prepare(ctx context.Context, a *PrepareMsg) (resp *PromiseMsg, err error)
- func (c *Configuration) Size() int
- func (c *Configuration) String() string
- func (c *Configuration) SubError() <-chan GRPCError
- type Empty
- func (*Empty) Descriptor() ([]byte, []int)
- func (this *Empty) Equal(that interface{}) bool
- func (m *Empty) Marshal() (dAtA []byte, err error)
- func (m *Empty) MarshalTo(dAtA []byte) (int, error)
- func (*Empty) ProtoMessage()
- func (m *Empty) Reset()
- func (m *Empty) Size() (n int)
- func (this *Empty) String() string
- func (m *Empty) Unmarshal(dAtA []byte) error
- type GRPCError
- type Heartbeat
- func (*Heartbeat) Descriptor() ([]byte, []int)
- func (this *Heartbeat) Equal(that interface{}) bool
- func (m *Heartbeat) GetId() uint32
- func (m *Heartbeat) Marshal() (dAtA []byte, err error)
- func (m *Heartbeat) MarshalTo(dAtA []byte) (int, error)
- func (*Heartbeat) ProtoMessage()
- func (m *Heartbeat) Reset()
- func (m *Heartbeat) Size() (n int)
- func (this *Heartbeat) String() string
- func (m *Heartbeat) Unmarshal(dAtA []byte) error
- type IllegalConfigError
- type LeaderDetector
- type LearnMsg
- func (*LearnMsg) Descriptor() ([]byte, []int)
- func (this *LearnMsg) Equal(that interface{}) bool
- func (m *LearnMsg) GetRnd() uint32
- func (m *LearnMsg) GetVal() *Value
- func (m *LearnMsg) Marshal() (dAtA []byte, err error)
- func (m *LearnMsg) MarshalTo(dAtA []byte) (int, error)
- func (*LearnMsg) ProtoMessage()
- func (m *LearnMsg) Reset()
- func (m *LearnMsg) Size() (n int)
- func (this *LearnMsg) String() string
- func (m *LearnMsg) Unmarshal(dAtA []byte) error
- type Manager
- func (m *Manager) AddNode(addr string) error
- func (m *Manager) Close()
- func (m *Manager) Configuration(id uint32) (config *Configuration, found bool)
- func (m *Manager) ConfigurationIDs() []uint32
- func (m *Manager) Configurations() []*Configuration
- func (m *Manager) NewConfiguration(ids []uint32, qspec QuorumSpec) (*Configuration, error)
- func (m *Manager) Node(id uint32) (node *Node, found bool)
- func (m *Manager) NodeIDs() []uint32
- func (m *Manager) Nodes() []*Node
- func (m *Manager) Size() (nodes, configs int)
- type ManagerOption
- type MultiSorter
- type Node
- type NodeNotFoundError
- type PaxosQSpec
- func (qs PaxosQSpec) AcceptQF(replies []*LearnMsg) (*LearnMsg, bool)
- func (qs PaxosQSpec) ClientHandleQF(replies []*Response) (*Response, bool)
- func (qs PaxosQSpec) CommitQF(replies []*Empty) (*Empty, bool)
- func (qs PaxosQSpec) PrepareQF(prepare *PrepareMsg, replies []*PromiseMsg) (*PromiseMsg, bool)
- type PaxosReplica
- func (r *PaxosReplica) Accept(ctx context.Context, accMsg *AcceptMsg) (*LearnMsg, error)
- func (r *PaxosReplica) ClientHandle(ctx context.Context, req *Value) (rsp *Response, err error)
- func (r *PaxosReplica) Commit(ctx context.Context, lrnMsg *LearnMsg) (*Empty, error)
- func (r *PaxosReplica) Ping(ctx context.Context, hb *Heartbeat) (*Heartbeat, error)
- func (r *PaxosReplica) Prepare(ctx context.Context, prepMsg *PrepareMsg) (*PromiseMsg, error)
- type PrepareMsg
- func (*PrepareMsg) Descriptor() ([]byte, []int)
- func (this *PrepareMsg) Equal(that interface{}) bool
- func (m *PrepareMsg) GetRnd() uint32
- func (m *PrepareMsg) Marshal() (dAtA []byte, err error)
- func (m *PrepareMsg) MarshalTo(dAtA []byte) (int, error)
- func (*PrepareMsg) ProtoMessage()
- func (m *PrepareMsg) Reset()
- func (m *PrepareMsg) Size() (n int)
- func (this *PrepareMsg) String() string
- func (m *PrepareMsg) Unmarshal(dAtA []byte) error
- type PromiseMsg
- func (*PromiseMsg) Descriptor() ([]byte, []int)
- func (this *PromiseMsg) Equal(that interface{}) bool
- func (m *PromiseMsg) GetRnd() uint32
- func (m *PromiseMsg) GetVrnd() uint32
- func (m *PromiseMsg) GetVval() *Value
- func (m *PromiseMsg) Marshal() (dAtA []byte, err error)
- func (m *PromiseMsg) MarshalTo(dAtA []byte) (int, error)
- func (*PromiseMsg) ProtoMessage()
- func (m *PromiseMsg) Reset()
- func (m *PromiseMsg) Size() (n int)
- func (this *PromiseMsg) String() string
- func (m *PromiseMsg) Unmarshal(dAtA []byte) error
- type Proposer
- type QuorumCallError
- type QuorumSpec
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (this *Response) Equal(that interface{}) bool
- func (m *Response) GetClientResponse() string
- func (m *Response) Marshal() (dAtA []byte, err error)
- func (m *Response) MarshalTo(dAtA []byte) (int, error)
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) Size() (n int)
- func (this *Response) String() string
- func (m *Response) Unmarshal(dAtA []byte) error
- type Restorer
- type Round
- func (*Round) Descriptor() ([]byte, []int)
- func (this *Round) Equal(that interface{}) bool
- func (m *Round) GetRnd() uint32
- func (m *Round) Marshal() (dAtA []byte, err error)
- func (m *Round) MarshalTo(dAtA []byte) (int, error)
- func (*Round) ProtoMessage()
- func (m *Round) Reset()
- func (m *Round) Size() (n int)
- func (this *Round) String() string
- func (m *Round) Unmarshal(dAtA []byte) error
- type SinglePaxosClient
- type SinglePaxosServer
- type SuspectRestorer
- type Suspecter
- type Value
- func (*Value) Descriptor() ([]byte, []int)
- func (this *Value) Equal(that interface{}) bool
- func (m *Value) GetClientRequest() string
- func (m *Value) Marshal() (dAtA []byte, err error)
- func (m *Value) MarshalTo(dAtA []byte) (int, error)
- func (*Value) ProtoMessage()
- func (m *Value) Reset()
- func (m *Value) Size() (n int)
- func (this *Value) String() string
- func (m *Value) Unmarshal(dAtA []byte) error
Constants ¶
const ( NoRound uint32 = 0 Ignore uint32 = 0 )
Initial values in each replica.
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 ¶
var ( LeaderChan = make(chan *Node, 8) FailurePhaseOneChan = make(chan bool, 8) FailurePhaseTwoChan = make(chan bool, 8) SuccessPhaseChan = make(chan int, 8) )
var ( ErrInvalidLengthSinglepaxos = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSinglepaxos = fmt.Errorf("proto: integer overflow") )
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.
var ID = func(n1, n2 *Node) bool {
return n1.id < n2.id
}
ID sorts nodes by their identifier in increasing order.
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.
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.
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 ¶
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 ¶
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) ProtoMessage ¶
func (*AcceptMsg) ProtoMessage()
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 ¶
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 ¶
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 ¶
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) ProtoMessage ¶
func (*Empty) ProtoMessage()
type Heartbeat ¶
type Heartbeat struct {
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (*Heartbeat) Descriptor ¶
func (*Heartbeat) ProtoMessage ¶
func (*Heartbeat) ProtoMessage()
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) ProtoMessage ¶
func (*LearnMsg) ProtoMessage()
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 ¶
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 ¶
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) NodeIDs ¶
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.
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) 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.
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) FullString ¶
func (*Node) LastErr ¶
LastErr returns the last error encountered (if any) when invoking a remote procedure call on this node.
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 ¶
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 (*PaxosReplica) Commit ¶
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) 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) 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) 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 ¶
DeliverClientValue delivers client value cval to proposer.
type QuorumCallError ¶
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) GetClientResponse ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
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) ProtoMessage ¶
func (*Round) ProtoMessage()
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 ¶
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) GetClientRequest ¶
func (*Value) ProtoMessage ¶
func (*Value) ProtoMessage()