Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionProvider ¶
type ConnectionProvider interface { // Call returns true if and only if the call was successful Call(server string, svcName string, svcMeth string, args interface{}, reply interface{}) bool // Me returns the address of this Host Me() string NumPeers() int }
Serves as an additional abstraction over labrpc/networking. Raft + the client
identify servers by indices. This interface is responsible for taking a call, translating the index into either a 'labrpc' end or an actual network connection and executing the rpc just as labrpc does. Using this class should let us maintain a similar interface in our code but swap out whether we want to use labrpc or real ip addresses
type LabrpcConnectionProvider ¶
type LabrpcConnectionProvider struct {
// contains filtered or unexported fields
}
Implements the ConnectionProvider interface using the laprpc library
func (*LabrpcConnectionProvider) Call ¶
func (cp *LabrpcConnectionProvider) Call(server string, svcName string, svcMeth string, args interface{}, reply interface{}) bool
func (*LabrpcConnectionProvider) Me ¶
func (cp *LabrpcConnectionProvider) Me() string
func (*LabrpcConnectionProvider) NumPeers ¶
func (cp *LabrpcConnectionProvider) NumPeers() int
type Libp2pConnectionProvider ¶
Libp2pConnectionProvider implements the ConnectionProvider interface using libp2p
func NewLibp2p ¶
func NewLibp2p() *Libp2pConnectionProvider
func (*Libp2pConnectionProvider) Call ¶
func (cp *Libp2pConnectionProvider) Call(server string, svcName string, svcMeth string, args interface{}, reply interface{}) bool
func (*Libp2pConnectionProvider) Me ¶
func (cp *Libp2pConnectionProvider) Me() string
func (*Libp2pConnectionProvider) NumPeers ¶
func (cp *Libp2pConnectionProvider) NumPeers() int
Click to show internal directories.
Click to hide internal directories.