candidate

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	fx.In

	*common.CommonAPI
	*asset.Asset
	*device.Device
	*vd.Validation
	*datasync.DataSync

	Scheduler api.Scheduler
	Config    *config.CandidateCfg
	TCPSrv    *TCPServer
}

Candidate represents the c node.

func (*Candidate) CheckNetworkConnectivity

func (c *Candidate) CheckNetworkConnectivity(ctx context.Context, network, targetURL string) error

checkNetworkConnectivity check tcp or udp network connectivity network is "tcp" or "udp"

func (*Candidate) GetBlocksWithAssetCID

func (c *Candidate) GetBlocksWithAssetCID(ctx context.Context, assetCID string, randomSeed int64, randomCount int) ([]string, error)

GetBlocksWithAssetCID returns a map of blocks with given asset CID, random seed, and random count.

func (*Candidate) GetExternalAddress

func (c *Candidate) GetExternalAddress(ctx context.Context) (string, error)

GetExternalAddress retrieves the external address of the caller.

func (*Candidate) GetMinioConfig added in v0.1.11

func (c *Candidate) GetMinioConfig(ctx context.Context) (*types.MinioConfig, error)

func (*Candidate) WaitQuiet

func (c *Candidate) WaitQuiet(ctx context.Context) error

WaitQuiet does nothing and returns nil error.

type NodeValidatedResulter

type NodeValidatedResulter interface {
	NodeValidationResult(ctx context.Context, r io.Reader, sign string) error
}

NodeValidatedResulter is the interface to return the validation result

type TCPServer

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

TCPServer handles incoming TCP connections from devices.

func NewTCPServer

func NewTCPServer(cfg *config.CandidateCfg, schedulerAPI api.Scheduler, key *rsa.PrivateKey) *TCPServer

NewTCPServer initializes a new instance of TCPServer.

func (*TCPServer) StartTCPServer

func (t *TCPServer) StartTCPServer()

StartTCPServer starts listening for incoming TCP connections.

func (*TCPServer) Stop

func (t *TCPServer) Stop(ctx context.Context) error

Stop stops the TCP server.

Jump to

Keyboard shortcuts

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