supernode

package
v0.4.11-rc2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: MIT Imports: 18 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 pstore.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) (pstore.PeerInfo, error)

func (*Client) FindProvidersAsync

func (c *Client) FindProvidersAsync(ctx context.Context, k *cid.Cid, max int) <-chan pstore.PeerInfo

func (*Client) GetValue

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

func (*Client) GetValues added in v0.3.8

func (c *Client) GetValues(ctx context.Context, k string, _ int) ([]routing.RecvdVal, 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 *cid.Cid, brd bool) error

Provide adds the given key 'k' to the content routing system. If 'brd' is true, it announces that content to the network. For the supernode client, setting 'brd' to false makes this call a no-op

func (*Client) PutValue

func (c *Client) PutValue(ctx context.Context, k string, 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.Datastore, ps pstore.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