titan

package
v0.0.0-...-1059341 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PullData

func PullData(ctx context.Context, client *http.Client, edge *types.Edge, cid string, format string, requestHeader http.Header) (int64, []byte, error)

Types

type ReaderStream

type ReaderStream struct {
	Type StreamType
	Info string
}

ReaderStream indicating the uuid of push request, ex: `ReaderStream{ Type: "push", Info: "[UUID string]" }

See https://github.com/Filecoin-Titan/titan/blob/main/lib/rpcenc/reader.go#L50

type Service

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

func New

func New(options config.Config) (*Service, error)

func (*Service) Close

func (s *Service) Close() error

func (*Service) Discover

func (s *Service) Discover() (t types.NATType, e error)

Discover client-side NAT type discovery

func (*Service) EndOfFile

func (s *Service) EndOfFile() error

func (*Service) FilterAccessibleNodes

func (s *Service) FilterAccessibleNodes(ctx context.Context, edges []*types.Edge) (map[string]*types.Client, error)

FilterAccessibleNodes filtering out the list of available edges to only include those that are accessible by the client and added to the list of accessible accessibleEdges.

func (*Service) GetAccessibleEdges

func (s *Service) GetAccessibleEdges(ctx context.Context, cid cid.Cid) (map[string]*types.Client, error)

func (*Service) GetBlock

func (s *Service) GetBlock(ctx context.Context, cid cid.Cid) (blocks.Block, error)

GetBlock retrieves a raw block from titan http gateway

func (*Service) GetCandidates

func (s *Service) GetCandidates(schedulerURL string) ([]string, error)

GetCandidates get candidates list in the same region

func (*Service) GetDefaultClient

func (s *Service) GetDefaultClient() *http.Client

func (*Service) GetEdgeNodesByFile

func (s *Service) GetEdgeNodesByFile(cid cid.Cid) ([]*types.Edge, error)

func (*Service) GetPublicAddress

func (s *Service) GetPublicAddress(schedulerURL string) (types.Host, error)

GetPublicAddress return the public address

func (*Service) GetRange

func (s *Service) GetRange(ctx context.Context, c *types.Client, cid cid.Cid, start, end int64) (int64, []byte, error)

GetRange retrieves specific byte ranges of UnixFS files and raw blocks.

func (*Service) GetSchedulers

func (s *Service) GetSchedulers() ([]string, error)

GetSchedulers get scheduler list in the same region

func (*Service) GroupByEdges

func (s *Service) GroupByEdges(ctx context.Context, cid cid.Cid) ([]*types.Edge, []*types.Edge, error)

func (*Service) NatPunching

func (s *Service) NatPunching(edge *types.Edge) error

NatPunching creates a connection from edge node side for the application via the scheduler

func (*Service) RequestCandidateToSendPackets

func (s *Service) RequestCandidateToSendPackets(remoteAddr string, network, url string) error

RequestCandidateToSendPackets sends packet from server side to determine the application connectivity

func (*Service) SubmitProofOfWork

func (s *Service) SubmitProofOfWork(schedulerAddr string, data []byte) error

SubmitProofOfWork submits a proof of work for a downloaded file

func (*Service) Version

func (s *Service) Version(client *http.Client, remoteAddr string) error

Version get titan server version

type Strategy

type Strategy func(edges []*types.Client) func() *types.Client

type StreamType

type StreamType string
const (
	Null       StreamType = "null"
	PushStream StreamType = "push"
)

Jump to

Keyboard shortcuts

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