supernode

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(px proxy.Proxy, h host.Host, ps peer.Peerstore, local peer.ID) (*Client, error)

TODO take in datastore/cache

func (*Client) Bootstrap

func (c *Client) Bootstrap(ctx context.Context) error

func (*Client) FindPeer

func (c *Client) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, error)

func (*Client) FindProvidersAsync

func (c *Client) FindProvidersAsync(ctx context.Context, k u.Key, max int) <-chan peer.PeerInfo

func (*Client) GetValue

func (c *Client) GetValue(ctx context.Context, k u.Key) ([]byte, error)

func (*Client) Ping

func (c *Client) Ping(ctx context.Context, id peer.ID) (time.Duration, error)

func (*Client) Provide

func (c *Client) Provide(ctx context.Context, k u.Key) error

func (*Client) PutValue

func (c *Client) PutValue(ctx context.Context, k u.Key, v []byte) error

type Server

type Server struct {
	*proxy.Loopback // so server can be injected into client
	// contains filtered or unexported fields
}

Server handles routing queries using a database backend

func NewServer

func NewServer(ds datastore.ThreadSafeDatastore, ps peer.Peerstore, local peer.ID) (*Server, error)

NewServer creates a new Supernode routing Server

func (*Server) Bootstrap

func (_ *Server) Bootstrap(ctx context.Context) error

func (*Server) HandleRequest

func (s *Server) HandleRequest(ctx context.Context, p peer.ID, req *dhtpb.Message) *dhtpb.Message

HandleLocalRequest implements the proxy.RequestHandler interface. This is where requests are received from the outside world.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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