Documentation ¶
Index ¶
- func ChordStatsHandler(rootNode *LocalNode, virtualNodes []*LocalNode) http.Handler
- type LocalNode
- func (n *LocalNode) Acquire(ctx context.Context, lease []byte, ttl time.Duration) (uint64, error)
- func (n *LocalNode) AttachExternal(ctx context.Context, listener net.Listener)
- func (n *LocalNode) AttachRoot(ctx context.Context, router *transport.StreamRouter)
- func (n *LocalNode) AttachRouter(ctx context.Context, router *transport.StreamRouter)
- func (n *LocalNode) Create() error
- func (n *LocalNode) Delete(ctx context.Context, key []byte) error
- func (n *LocalNode) FindSuccessor(key uint64) (chord.VNode, error)
- func (n *LocalNode) FinishJoin(stabilize bool, release bool) error
- func (n *LocalNode) FinishLeave(stabilize bool, release bool) error
- func (n *LocalNode) Get(ctx context.Context, key []byte) ([]byte, error)
- func (n *LocalNode) GetPredecessor() (chord.VNode, error)
- func (n *LocalNode) GetSuccessors() ([]chord.VNode, error)
- func (n *LocalNode) ID() uint64
- func (n *LocalNode) Identity() *protocol.Node
- func (n *LocalNode) Import(ctx context.Context, keys [][]byte, values []*protocol.KVTransfer) error
- func (n *LocalNode) Join(peer chord.VNode) error
- func (n *LocalNode) Leave()
- func (n *LocalNode) ListKeys(ctx context.Context, prefix []byte) ([]*protocol.KeyComposite, error)
- func (n *LocalNode) Notify(predecessor chord.VNode) error
- func (n *LocalNode) Ping() error
- func (n *LocalNode) PrefixAppend(ctx context.Context, prefix []byte, child []byte) error
- func (n *LocalNode) PrefixContains(ctx context.Context, prefix []byte, child []byte) (bool, error)
- func (n *LocalNode) PrefixList(ctx context.Context, prefix []byte) ([][]byte, error)
- func (n *LocalNode) PrefixRemove(ctx context.Context, prefix []byte, child []byte) error
- func (n *LocalNode) Put(ctx context.Context, key, value []byte) error
- func (n *LocalNode) Release(ctx context.Context, lease []byte, token uint64) error
- func (n *LocalNode) Renew(ctx context.Context, lease []byte, ttl time.Duration, prevToken uint64) (uint64, error)
- func (n *LocalNode) RequestToJoin(joiner chord.VNode) (chord.VNode, []chord.VNode, error)
- func (n *LocalNode) RequestToLeave(leaver chord.VNode) error
- type NodeConfig
- type RemoteNode
- func (n *RemoteNode) Acquire(ctx context.Context, lease []byte, ttl time.Duration) (uint64, error)
- func (n *RemoteNode) Delete(ctx context.Context, key []byte) error
- func (n *RemoteNode) FindSuccessor(key uint64) (chord.VNode, error)
- func (n *RemoteNode) FinishJoin(stabilize bool, release bool) error
- func (n *RemoteNode) FinishLeave(stabilize bool, release bool) error
- func (n *RemoteNode) Get(ctx context.Context, key []byte) ([]byte, error)
- func (n *RemoteNode) GetPredecessor() (chord.VNode, error)
- func (n *RemoteNode) GetSuccessors() ([]chord.VNode, error)
- func (n *RemoteNode) ID() uint64
- func (n *RemoteNode) Identity() *protocol.Node
- func (n *RemoteNode) Import(ctx context.Context, keys [][]byte, values []*protocol.KVTransfer) error
- func (n *RemoteNode) ListKeys(ctx context.Context, prefix []byte) ([]*protocol.KeyComposite, error)
- func (n *RemoteNode) Notify(predecessor chord.VNode) error
- func (n *RemoteNode) Ping() error
- func (n *RemoteNode) PrefixAppend(ctx context.Context, prefix []byte, child []byte) error
- func (n *RemoteNode) PrefixContains(ctx context.Context, prefix []byte, child []byte) (bool, error)
- func (n *RemoteNode) PrefixList(ctx context.Context, prefix []byte) ([][]byte, error)
- func (n *RemoteNode) PrefixRemove(ctx context.Context, prefix []byte, child []byte) error
- func (n *RemoteNode) Put(ctx context.Context, key, value []byte) error
- func (n *RemoteNode) Release(ctx context.Context, lease []byte, token uint64) error
- func (n *RemoteNode) Renew(ctx context.Context, lease []byte, ttl time.Duration, prevToken uint64) (newToken uint64, err error)
- func (n *RemoteNode) RequestToJoin(joiner chord.VNode) (chord.VNode, []chord.VNode, error)
- func (n *RemoteNode) RequestToLeave(leaver chord.VNode) error
- type RemoteNodeFactory
- type Server
- func (r *Server) Acquire(ctx context.Context, req *protocol.LeaseRequest) (*protocol.LeaseResponse, error)
- func (r *Server) Append(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
- func (r *Server) Contains(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
- func (r *Server) Delete(ctx context.Context, req *protocol.SimpleRequest) (*protocol.SimpleResponse, error)
- func (r *Server) FindSuccessor(_ context.Context, req *protocol.FindSuccessorRequest) (*protocol.FindSuccessorResponse, error)
- func (r *Server) FinishJoin(_ context.Context, req *protocol.MembershipConclusionRequest) (*protocol.MembershipConclusionResponse, error)
- func (r *Server) FinishLeave(_ context.Context, req *protocol.MembershipConclusionRequest) (*protocol.MembershipConclusionResponse, error)
- func (r *Server) Get(ctx context.Context, req *protocol.SimpleRequest) (*protocol.SimpleResponse, error)
- func (r *Server) GetPredecessor(_ context.Context, _ *protocol.GetPredecessorRequest) (*protocol.GetPredecessorResponse, error)
- func (r *Server) GetSuccessors(_ context.Context, _ *protocol.GetSuccessorsRequest) (*protocol.GetSuccessorsResponse, error)
- func (r *Server) Identity(_ context.Context, _ *protocol.IdentityRequest) (*protocol.IdentityResponse, error)
- func (r *Server) Import(ctx context.Context, req *protocol.ImportRequest) (*protocol.ImportResponse, error)
- func (r *Server) List(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
- func (r *Server) ListKeys(ctx context.Context, req *protocol.ListKeysRequest) (*protocol.ListKeysResponse, error)
- func (r *Server) Notify(_ context.Context, req *protocol.NotifyRequest) (*protocol.NotifyResponse, error)
- func (r *Server) Ping(_ context.Context, _ *protocol.PingRequest) (*protocol.PingResponse, error)
- func (r *Server) Put(ctx context.Context, req *protocol.SimpleRequest) (*protocol.SimpleResponse, error)
- func (r *Server) Release(ctx context.Context, req *protocol.LeaseRequest) (*protocol.LeaseResponse, error)
- func (r *Server) Remove(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
- func (r *Server) Renew(ctx context.Context, req *protocol.LeaseRequest) (*protocol.LeaseResponse, error)
- func (r *Server) RequestToJoin(_ context.Context, req *protocol.RequestToJoinRequest) (*protocol.RequestToJoinResponse, error)
- func (r *Server) RequestToLeave(_ context.Context, req *protocol.RequestToLeaveRequest) (*protocol.RequestToLeaveResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LocalNode ¶
type LocalNode struct { NodeConfig // contains filtered or unexported fields }
func NewLocalNode ¶
func NewLocalNode(conf NodeConfig) *LocalNode
func (*LocalNode) AttachExternal ¶
func (*LocalNode) AttachRoot ¶
func (n *LocalNode) AttachRoot(ctx context.Context, router *transport.StreamRouter)
func (*LocalNode) AttachRouter ¶
func (n *LocalNode) AttachRouter(ctx context.Context, router *transport.StreamRouter)
func (*LocalNode) FindSuccessor ¶
func (*LocalNode) PrefixAppend ¶
func (*LocalNode) PrefixContains ¶
func (*LocalNode) PrefixList ¶
func (*LocalNode) PrefixRemove ¶
func (*LocalNode) RequestToJoin ¶
type NodeConfig ¶
type NodeConfig struct { KVProvider chord.KVProvider ChordClient rpc.ChordClient BaseLogger *zap.Logger Identity *protocol.Node NodesRTT rtt.Recorder StabilizeInterval time.Duration FixFingerInterval time.Duration PredecessorCheckInterval time.Duration }
func (*NodeConfig) Validate ¶
func (c *NodeConfig) Validate() error
type RemoteNode ¶
type RemoteNode struct {
// contains filtered or unexported fields
}
func NewRemoteNode ¶
func NewRemoteNode(ctx context.Context, baseLogger *zap.Logger, chordClient rpc.ChordClient, peer *protocol.Node) (*RemoteNode, error)
func (*RemoteNode) FindSuccessor ¶
func (n *RemoteNode) FindSuccessor(key uint64) (chord.VNode, error)
func (*RemoteNode) FinishJoin ¶
func (n *RemoteNode) FinishJoin(stabilize bool, release bool) error
func (*RemoteNode) FinishLeave ¶
func (n *RemoteNode) FinishLeave(stabilize bool, release bool) error
func (*RemoteNode) GetPredecessor ¶
func (n *RemoteNode) GetPredecessor() (chord.VNode, error)
func (*RemoteNode) GetSuccessors ¶
func (n *RemoteNode) GetSuccessors() ([]chord.VNode, error)
func (*RemoteNode) ID ¶
func (n *RemoteNode) ID() uint64
func (*RemoteNode) Identity ¶
func (n *RemoteNode) Identity() *protocol.Node
func (*RemoteNode) Import ¶
func (n *RemoteNode) Import(ctx context.Context, keys [][]byte, values []*protocol.KVTransfer) error
func (*RemoteNode) ListKeys ¶
func (n *RemoteNode) ListKeys(ctx context.Context, prefix []byte) ([]*protocol.KeyComposite, error)
func (*RemoteNode) Ping ¶
func (n *RemoteNode) Ping() error
func (*RemoteNode) PrefixAppend ¶
func (*RemoteNode) PrefixContains ¶
func (*RemoteNode) PrefixList ¶
func (*RemoteNode) PrefixRemove ¶
func (*RemoteNode) RequestToJoin ¶
func (*RemoteNode) RequestToLeave ¶
func (n *RemoteNode) RequestToLeave(leaver chord.VNode) error
type Server ¶
type Server struct { LocalNode chord.VNode Factory RemoteNodeFactory }
func (*Server) Acquire ¶
func (r *Server) Acquire(ctx context.Context, req *protocol.LeaseRequest) (*protocol.LeaseResponse, error)
func (*Server) Append ¶
func (r *Server) Append(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
func (*Server) Contains ¶
func (r *Server) Contains(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
func (*Server) Delete ¶
func (r *Server) Delete(ctx context.Context, req *protocol.SimpleRequest) (*protocol.SimpleResponse, error)
func (*Server) FindSuccessor ¶
func (r *Server) FindSuccessor(_ context.Context, req *protocol.FindSuccessorRequest) (*protocol.FindSuccessorResponse, error)
func (*Server) FinishJoin ¶
func (r *Server) FinishJoin(_ context.Context, req *protocol.MembershipConclusionRequest) (*protocol.MembershipConclusionResponse, error)
func (*Server) FinishLeave ¶
func (r *Server) FinishLeave(_ context.Context, req *protocol.MembershipConclusionRequest) (*protocol.MembershipConclusionResponse, error)
func (*Server) Get ¶
func (r *Server) Get(ctx context.Context, req *protocol.SimpleRequest) (*protocol.SimpleResponse, error)
func (*Server) GetPredecessor ¶
func (r *Server) GetPredecessor(_ context.Context, _ *protocol.GetPredecessorRequest) (*protocol.GetPredecessorResponse, error)
func (*Server) GetSuccessors ¶
func (r *Server) GetSuccessors(_ context.Context, _ *protocol.GetSuccessorsRequest) (*protocol.GetSuccessorsResponse, error)
func (*Server) Identity ¶
func (r *Server) Identity(_ context.Context, _ *protocol.IdentityRequest) (*protocol.IdentityResponse, error)
func (*Server) Import ¶
func (r *Server) Import(ctx context.Context, req *protocol.ImportRequest) (*protocol.ImportResponse, error)
func (*Server) List ¶
func (r *Server) List(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
func (*Server) ListKeys ¶
func (r *Server) ListKeys(ctx context.Context, req *protocol.ListKeysRequest) (*protocol.ListKeysResponse, error)
func (*Server) Notify ¶
func (r *Server) Notify(_ context.Context, req *protocol.NotifyRequest) (*protocol.NotifyResponse, error)
func (*Server) Ping ¶
func (r *Server) Ping(_ context.Context, _ *protocol.PingRequest) (*protocol.PingResponse, error)
func (*Server) Put ¶
func (r *Server) Put(ctx context.Context, req *protocol.SimpleRequest) (*protocol.SimpleResponse, error)
func (*Server) Release ¶
func (r *Server) Release(ctx context.Context, req *protocol.LeaseRequest) (*protocol.LeaseResponse, error)
func (*Server) Remove ¶
func (r *Server) Remove(ctx context.Context, req *protocol.PrefixRequest) (*protocol.PrefixResponse, error)
func (*Server) Renew ¶
func (r *Server) Renew(ctx context.Context, req *protocol.LeaseRequest) (*protocol.LeaseResponse, error)
func (*Server) RequestToJoin ¶
func (r *Server) RequestToJoin(_ context.Context, req *protocol.RequestToJoinRequest) (*protocol.RequestToJoinResponse, error)
func (*Server) RequestToLeave ¶
func (r *Server) RequestToLeave(_ context.Context, req *protocol.RequestToLeaveRequest) (*protocol.RequestToLeaveResponse, error)
Click to show internal directories.
Click to hide internal directories.