core

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DHT

type DHT struct {
	structs.Node
	RoutingTable *structs.RoutingTable
	Storage      interfaces.Persistence
}

func (*DHT) FindNode

func (fn *DHT) FindNode(target *[]byte) (kBucket *[]structs.Node)

func (*DHT) FindValue

func (fn *DHT) FindValue(infoHash *[]byte, start int64, end int64) (value *[]byte, neighbors *[]structs.Node)

func (*DHT) Store

func (fn *DHT) Store(key []byte, data *[]byte) error

type FullNode

type FullNode struct {
	pb.UnimplementedFullNodeServer
	// contains filtered or unexported fields
}

func NewFullNode

func NewFullNode(nodeIP string, nodePort, bootstrapPort int, storage interfaces.Persistence, isBootstrapNode bool) *FullNode

func (*FullNode) CreateGRPCServer added in v0.4.4

func (fn *FullNode) CreateGRPCServer(grpcServerAddress string)

Create gRPC Server

func (*FullNode) FindNode

func (fn *FullNode) FindNode(ctx context.Context, target *pb.Target) (*pb.KBucket, error)

func (*FullNode) FindValue

func (fn *FullNode) FindValue(target *pb.Target, stream pb.FullNode_FindValueServer) error

func (*FullNode) GetValue

func (fn *FullNode) GetValue(target string, start int64, end int64) ([]byte, error)

func (*FullNode) LookUp

func (fn *FullNode) LookUp(target []byte) ([]structs.Node, error)

func (*FullNode) Ping

func (fn *FullNode) Ping(ctx context.Context, sender *pb.Node) (*pb.Node, error)

func (*FullNode) PrintRoutingTable

func (fn *FullNode) PrintRoutingTable()

func (*FullNode) Republish added in v0.5.3

func (fn *FullNode) Republish()

func (*FullNode) Store

func (fn *FullNode) Store(stream pb.FullNode_StoreServer) error

func (*FullNode) StoreValue

func (fn *FullNode) StoreValue(key string, data *[]byte) (string, error)

type FullNodeClient

type FullNodeClient struct {
	pb.FullNodeClient
	IP   string
	Port int
}

func NewClientNode

func NewClientNode(ip string, port int) *FullNodeClient

func (*FullNodeClient) Ping

func (fn *FullNodeClient) Ping(sender structs.Node) (*structs.Node, error)

Jump to

Keyboard shortcuts

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