httpserver

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset interface {
	// GetAsset fetches the asset data for a given CID and returns an io.ReadSeekCloser.
	GetAsset(root cid.Cid) (io.ReadSeekCloser, error)
	// AssetExists checks whether the asset data for a given CID exists or not.
	AssetExists(root cid.Cid) (bool, error)
	// HasBlock checks if a block with the given CID is present in the asset data for a given root CID.
	HasBlock(ctx context.Context, root, block cid.Cid) (bool, error)
	// GetBlock retrieves a block with the given CID from the asset data for a given root CID.
	GetBlock(ctx context.Context, root, block cid.Cid) (blocks.Block, error)
}

Asset represents an interface for fetching and checking asset data.

type Handler

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

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP checks if the request path starts with the IPFS path prefix and delegates to the appropriate handler

type HttpServer

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

func NewHttpServer

func NewHttpServer(asset Asset, scheduler api.Scheduler, privateKey *rsa.PrivateKey, validation Validation) *HttpServer

NewHttpServer creates a new HttpServer with the given Asset, Scheduler, and RSA private key.

func (*HttpServer) DownloadThreadCount

func (hs *HttpServer) DownloadThreadCount() uint32

GetDownloadThreadCount get download thread count of httpserver

func (*HttpServer) NewHandler

func (hs *HttpServer) NewHandler(handler http.Handler) http.Handler

NewHandler creates a new Handler with the given HTTP handler

func (*HttpServer) UpdateSchedulerPublicKey

func (hs *HttpServer) UpdateSchedulerPublicKey() error

SetSchedulerPublicKey sets the public key of the scheduler.

type Validation

type Validation interface {
	SetFunc(func() uint32)
	StopValidation()
}

Jump to

Keyboard shortcuts

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