Documentation ¶
Index ¶
- type BlackholeTransport
- func (*BlackholeTransport) ClearPredecessor(target, self *Vnode) error
- func (*BlackholeTransport) FindSuccessors(vn *Vnode, n int, key []byte) ([]*Vnode, error)
- func (*BlackholeTransport) GetPredecessor(vn *Vnode) (*Vnode, error)
- func (*BlackholeTransport) ListVnodes(host string) ([]*Vnode, error)
- func (*BlackholeTransport) Notify(vn, self *Vnode) ([]*Vnode, error)
- func (*BlackholeTransport) Ping(vn *Vnode) (bool, error)
- func (*BlackholeTransport) Register(v *Vnode, o VnodeRPC)
- func (*BlackholeTransport) SkipSuccessor(target, self *Vnode) error
- type Config
- type Delegate
- type LocalTransport
- func (lt *LocalTransport) ClearPredecessor(target, self *Vnode) error
- func (lt *LocalTransport) Deregister(v *Vnode)
- func (lt *LocalTransport) FindSuccessors(vn *Vnode, n int, key []byte) ([]*Vnode, error)
- func (lt *LocalTransport) GetPredecessor(vn *Vnode) (*Vnode, error)
- func (lt *LocalTransport) ListVnodes(host string) ([]*Vnode, error)
- func (lt *LocalTransport) Notify(vn, self *Vnode) ([]*Vnode, error)
- func (lt *LocalTransport) Ping(vn *Vnode) (bool, error)
- func (lt *LocalTransport) Register(v *Vnode, o VnodeRPC)
- func (lt *LocalTransport) SkipSuccessor(target, self *Vnode) error
- type Ring
- type Transport
- type Vnode
- type VnodeRPC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlackholeTransport ¶
type BlackholeTransport struct { }
BlackholeTransport is used to provide an implemenation of the Transport that does not actually do anything. Any operation will result in an error.
func (*BlackholeTransport) ClearPredecessor ¶
func (*BlackholeTransport) ClearPredecessor(target, self *Vnode) error
func (*BlackholeTransport) FindSuccessors ¶
func (*BlackholeTransport) GetPredecessor ¶
func (*BlackholeTransport) GetPredecessor(vn *Vnode) (*Vnode, error)
func (*BlackholeTransport) ListVnodes ¶
func (*BlackholeTransport) ListVnodes(host string) ([]*Vnode, error)
func (*BlackholeTransport) Notify ¶
func (*BlackholeTransport) Notify(vn, self *Vnode) ([]*Vnode, error)
func (*BlackholeTransport) Register ¶
func (*BlackholeTransport) Register(v *Vnode, o VnodeRPC)
func (*BlackholeTransport) SkipSuccessor ¶
func (*BlackholeTransport) SkipSuccessor(target, self *Vnode) error
type Config ¶
type Config struct { // Addr is the local address of this node. Addr string // NumVnodes is the number of virtual nodes (vnodes) per physical node. NumVnodes int // StabilizeMin in the minimum stabilization time StabilizeMin time.Duration // StabilizeMax is the stabilization time StabilizeMax time.Duration // NumSuccessors is the number of successors in the ring to maintain. NumSuccessors int // Delegate is invoked to handle ring events. Delegate Delegate HashFunc func() hash.Hash }
func DefaultConfig ¶
type Delegate ¶
type Delegate interface { NewPredecessor(local, remoteNew, remotePrev *Vnode) Leaving(local, pred, succ *Vnode) PredecessorLeaving(local, remote *Vnode) SuccessorLeaving(local, remote *Vnode) Shutdown() }
Delegate to notify on ring events
type LocalTransport ¶
type LocalTransport struct {
// contains filtered or unexported fields
}
LocalTransport is used to provides fast routing to Vnodes running locally using direct method calls. For any non-local vnodes, the request is passed on to another transport.
func (*LocalTransport) ClearPredecessor ¶
func (lt *LocalTransport) ClearPredecessor(target, self *Vnode) error
func (*LocalTransport) Deregister ¶
func (lt *LocalTransport) Deregister(v *Vnode)
func (*LocalTransport) FindSuccessors ¶
func (*LocalTransport) GetPredecessor ¶
func (lt *LocalTransport) GetPredecessor(vn *Vnode) (*Vnode, error)
func (*LocalTransport) ListVnodes ¶
func (lt *LocalTransport) ListVnodes(host string) ([]*Vnode, error)
func (*LocalTransport) Register ¶
func (lt *LocalTransport) Register(v *Vnode, o VnodeRPC)
func (*LocalTransport) SkipSuccessor ¶
func (lt *LocalTransport) SkipSuccessor(target, self *Vnode) error
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Stores the state required for a Chord ring
func (*Ring) Less ¶
Less returns whether the vnode with index i should sort before the vnode with index j.
type Transport ¶
type Transport interface { // Gets a list of the vnodes on the box ListVnodes(string) ([]*Vnode, error) // Ping a Vnode, check for liveness Ping(*Vnode) (bool, error) // Request a nodes predecessor GetPredecessor(*Vnode) (*Vnode, error) // Notify our successor of ourselves Notify(target, self *Vnode) ([]*Vnode, error) // Find a successor FindSuccessors(*Vnode, int, []byte) ([]*Vnode, error) // Clears a predecessor if it matches a given vnode. Used to leave. ClearPredecessor(target, self *Vnode) error // Instructs a node to skip a given successor. Used to leave. SkipSuccessor(target, self *Vnode) error // Register for an RPC callbacks Register(*Vnode, VnodeRPC) }
Implements the methods needed for a Chord ring
func InitLocalTransport ¶
Creates a local transport to wrap a remote transport
Source Files ¶
Click to show internal directories.
Click to hide internal directories.