Documentation ¶
Index ¶
- Constants
- Variables
- func StartClient(user int, server string, port int, testing bool)
- type AcceptArgs
- type AcceptReply
- type DecidedArgs
- type DecidedReply
- type Doc
- type DoneArgs
- type DoneReply
- type Err
- type Fate
- type InitArg
- type InitReply
- type Op
- type OpArg
- type OpReply
- type Paxage
- type Paxos
- func (px *Paxos) Accept(args AcceptArgs, reply *AcceptReply) error
- func (px *Paxos) Decided(args DecidedArgs, reply *DecidedReply) error
- func (px *Paxos) Done(seq int)
- func (px *Paxos) Lock()
- func (px *Paxos) Max() int
- func (px *Paxos) Min() int
- func (px *Paxos) Prepare(args PrepareArgs, reply *PrepareReply) error
- func (px *Paxos) Recover(data []byte)
- func (px *Paxos) ReplyDone(args DoneArgs, reply *DoneReply) error
- func (px *Paxos) Start(seq int, v interface{})
- func (px *Paxos) Unlock()
- type Pos
- type PrepareArgs
- type PrepareReply
- type QueryArg
- type QueryReply
- type RecoverArg
- type RecoverReply
- type Server
- func (s *Server) Copy(args *RecoverArg, reply *RecoverReply) error
- func (s *Server) Handle(arg OpArg, reply *OpReply) error
- func (s *Server) Init(arg InitArg, reply *InitReply) error
- func (s *Server) Query(arg QueryArg, reply *QueryReply) error
- func (s *Server) Recover(servers []string)
- func (s *Server) Start()
- type ViewSeq
Constants ¶
const ( Insert = iota Delete Newline Init Move Quit )
const Debug = true
const MAXUSERS = 3
const (
Port = 6060
)
const TABSTOP = 4
Variables ¶
var COLORS = []termbox.Attribute{16, 10, 11, 15, 0}
var CURSORS = []termbox.Attribute{253, 211, 121, 124, 0}
Functions ¶
Types ¶
type AcceptArgs ¶
type AcceptReply ¶
type AcceptReply struct {
Num int
}
type DecidedArgs ¶
type DecidedArgs struct { Seq int Val interface{} }
type DecidedReply ¶
type DecidedReply struct { }
type Fate ¶
type Fate int
px.Status() return Values, indicating whether an agreement has been decided, or Paxos has not yet reached agreement, or it was agreed but forgotten (i.e. < Min()).
type Paxos ¶
type Paxos struct { Stati map[int]Fate Hi int Lo int Hiprepare map[int]int Hiaccept map[int]int Val map[int]interface{} DoneSeqs []int // contains filtered or unexported fields }
func (*Paxos) Accept ¶
func (px *Paxos) Accept(args AcceptArgs, reply *AcceptReply) error
func (*Paxos) Decided ¶
func (px *Paxos) Decided(args DecidedArgs, reply *DecidedReply) error
func (*Paxos) Done ¶
the application on this machine is done with all instances <= Seq.
see the comments for Min() for more explanation.
func (*Paxos) Min ¶
Min() should return one more than the minimum among z_i, where z_i is the highest number ever passed to Done() on peer i. A peers z_i is -1 if it has never called Done().
Paxos is required to have forgotten all information about any instances it knows that are < Min(). The point is to free up memory in long-running Paxos-based servers.
Paxos peers need to exchange their highest Done() arguments in order to implement Min(). These exchanges can be piggybacked on ordinary Paxos agreement protocol messages, so it is OK if one peers Min does not reflect another Peers Done() until after the next instance is agreed to.
The fact that Min() is defined as a minimum over *all* Paxos peers means that Min() cannot increase until all peers have been heard from. So if a peer is dead or unreachable, other peers Min()s will not increase even if all reachable peers call Done. The reason for this is that when the unreachable peer comes back to life, it will need to catch up on instances that it missed -- the other peers therefor cannot forget these instances.
func (*Paxos) Prepare ¶
func (px *Paxos) Prepare(args PrepareArgs, reply *PrepareReply) error
type PrepareArgs ¶
type PrepareReply ¶
type QueryReply ¶
type RecoverArg ¶
type RecoverArg struct { }
type Server ¶
type Server struct { CommitLog []Op UserViews map[int]uint32 // last reported view number by user CommitPoint uint32 // the upper bound of our commit log (in absolute terms) DiscardPoint uint32 // ops below this have been discarded StartSeq int // seq number to Start paxos QuerySeq int // seq number to Query paxos ViewSeqs []ViewSeq // Paxos seqs -> Doc Views // contains filtered or unexported fields }
func (*Server) Copy ¶
func (s *Server) Copy(args *RecoverArg, reply *RecoverReply) error