Documentation
¶
Index ¶
- Constants
- func NewLibp2pTransport(h host.Host, dht *kaddht.IpfsDHT, timeout time.Duration, name string) (*raft.NetworkTransport, error)
- type Event
- type Event_Type
- type Observer
- type Operation
- type Replica
- func (self *Replica) AddCommand(ctx context.Context, op Operation) error
- func (self *Replica) AddState(name string, state State) error
- func (self *Replica) Bootstrap() error
- func (self *Replica) Close(ctx context.Context) error
- func (self *Replica) CloseObserver(obs Observer)
- func (self *Replica) CloseResultChan(opID string)
- func (self *Replica) ConnectPeer(ctx context.Context, pid peer.ID, writer bool) error
- func (self *Replica) ConnectedPeers() ([]peer.ID, error)
- func (self *Replica) CreateResultChannel(opID string) (chan interface{}, error)
- func (self *Replica) DisconnectPeer(ctx context.Context, pid peer.ID) error
- func (self *Replica) GetLeader(ctx context.Context) (peer.ID, error)
- func (self *Replica) HasMajority() bool
- func (self *Replica) IsLastPeer(pid peer.ID) (bool, error)
- func (self *Replica) IsRunning() bool
- func (self *Replica) Join() error
- func (self *Replica) NewObserver(blocking bool) Observer
- func (self *Replica) PrintConf()
- func (self *Replica) Shutdown(ctx context.Context) error
- func (self *Replica) TransferLeadership(ctx context.Context) (peer.ID, error)
- type State
Constants ¶
View Source
const Error_Arguments = "arguments_wrong" // arguments are invalid (e.g. wrong number, wrong type)
View Source
const Error_Authorisation = "authorisation_invalid" // error due to wrong authorisation
View Source
const Error_Invalid_Data = "data_invalid" // For all kind of wrong data errors
View Source
const Error_Operation_Invalid = "operation_invalid" // User operation not possible with current application state
View Source
const Error_Process = "process_failed" // For all kind of proccesses or operations
View Source
const Error_Setup = "setup_invalid" // The datastructures are not setup correctly
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Peer peer.ID
Event Event_Type
}
type Event_Type ¶
type Event_Type int
const ( EVENT_PEER_ADDED Event_Type = iota // new peer added to config (for leader only) EVENT_PEER_REMOVED // peer removed from config (for leader only) EVENT_LEADER_CHANGED // leader changed EVENT_MAJORITY_AVAILABLE // Majority of nodes online and reachable EVENT_MAJORITY_LOST // Cannot reach majority of notes )
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
func (Observer) EventChannel ¶
type Replica ¶
type Replica struct {
// contains filtered or unexported fields
}
func NewReplica ¶
func (*Replica) AddCommand ¶
func (*Replica) Bootstrap ¶
setup the replica completely new (to be done after all states are added)
func (*Replica) CloseObserver ¶
func (*Replica) CloseResultChan ¶
func (*Replica) ConnectPeer ¶
func (*Replica) CreateResultChannel ¶
func (*Replica) DisconnectPeer ¶
func (*Replica) HasMajority ¶
func (*Replica) Join ¶
starts the replica and waits to get added by the leader (to be done after all states are added)
func (*Replica) NewObserver ¶
Click to show internal directories.
Click to hide internal directories.