replica

package
v0.0.0-...-10f83ba Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2014 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	CommittedNotify chan struct{}
	ExecutedNotify  chan struct{}
	// contains filtered or unexported fields
}

func NewInstance

func NewInstance(replica *Replica, rowId uint8, instanceId uint64) (i *Instance)

func (*Instance) Commands

func (i *Instance) Commands() message.Commands

func (*Instance) Dependencies

func (i *Instance) Dependencies() message.Dependencies

func (*Instance) Pack

func (i *Instance) Pack() *PackedInstance

func (*Instance) SetExecuted

func (i *Instance) SetExecuted()

func (*Instance) StatusString

func (i *Instance) StatusString() string

func (*Instance) Unpack

func (i *Instance) Unpack(p *PackedInstance)

type InstanceInfo

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

bookkeeping struct for recording counts of different messages and some flags

func NewInstanceInfo

func NewInstanceInfo() *InstanceInfo

type PackedInstance

type PackedInstance struct {
	Cmds               message.Commands
	Deps               message.Dependencies
	Status             uint8
	Ballot             *message.Ballot
	RowId              uint8
	Id                 uint64
	Executed           bool
	PackedRecoveryInfo *PackedRecoveryInfo
}

This is for marshal/unmarshaling the instance

type PackedRecoveryInfo

type PackedRecoveryInfo struct {
	Ballot       *message.Ballot
	Cmds         message.Commands
	Deps         message.Dependencies
	Status       uint8
	FormerStatus uint8
}

type PackedReplica

type PackedReplica struct {
	Id             uint8
	Size           uint8
	MaxInstanceNum []uint64
	ExecutedUpTo   []uint64
	ProposeNum     uint64
}

type Param

type Param struct {
	ReplicaId        uint8
	Size             uint8
	StateMachine     epaxos.StateMachine
	CheckpointCycle  uint64
	BatchInterval    time.Duration
	TimeoutInterval  time.Duration
	ExecuteInterval  time.Duration
	Addrs            []string
	Transporter      epaxos.Transporter
	EnableBatching   bool
	EnablePersistent bool
	Restore          bool
	PersistentPath   string
}

type RecoveryInfo

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

recovery info will keep information of the instance info that we will send out on the next stage.

func NewRecoveryInfo

func NewRecoveryInfo() *RecoveryInfo

type Replica

type Replica struct {
	Id              uint8
	Size            uint8
	MaxInstanceNum  []uint64 // the highest instance number seen for each replica
	ProposeNum      uint64
	ProposeChan     chan *proposeRequest
	BatchInterval   time.Duration
	TimeoutInterval time.Duration

	CheckpointCycle uint64
	ExecutedUpTo    []uint64
	InstanceMatrix  [][]*Instance
	StateMachine    epaxos.StateMachine
	Epoch           uint32
	MessageChan     chan message.Message
	Addrs           []string
	Transporter     epaxos.Transporter
	// contains filtered or unexported fields
}

func New

func New(param *Param) (*Replica, error)

func (*Replica) F

func (r *Replica) F() int

func (*Replica) IsCheckpoint

func (r *Replica) IsCheckpoint(n uint64) bool

func (*Replica) Pack

func (r *Replica) Pack() *PackedReplica

pack and unpack the replica

func (*Replica) Propose

func (r *Replica) Propose(cmds ...message.Command) chan uint64

return the channel containing the internal instance id

func (*Replica) RecoverFromPersistent

func (r *Replica) RecoverFromPersistent() error

recover from persistent storage

func (*Replica) RestoreReplica

func (r *Replica) RestoreReplica() error

func (*Replica) RestoreSingleInstance

func (r *Replica) RestoreSingleInstance(rowId uint8, instanceId uint64) (*Instance, error)

func (*Replica) Start

func (r *Replica) Start() error

Start running the replica. It shouldn't stop at any time.

func (*Replica) Stop

func (r *Replica) Stop()

func (*Replica) StoreInstances

func (r *Replica) StoreInstances(insts ...*Instance) error

func (*Replica) StoreReplica

func (r *Replica) StoreReplica() error

store and restore the replica

func (*Replica) StoreSingleInstance

func (r *Replica) StoreSingleInstance(inst *Instance) error

store and restore the instance

func (*Replica) Unpack

func (r *Replica) Unpack(p *PackedReplica)

Jump to

Keyboard shortcuts

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