server

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const FindProvidersPath = "/routing/v1/providers/{cid}"
View Source
const ProvidePath = "/routing/v1/providers/"

Variables

This section is empty.

Functions

func Handler

func Handler(svc ContentRouter, opts ...Option) http.Handler

Types

type BitswapWriteProvideRequest

type BitswapWriteProvideRequest struct {
	Keys        []cid.Cid
	Timestamp   time.Time
	AdvisoryTTL time.Duration
	ID          peer.ID
	Addrs       []multiaddr.Multiaddr
}

type ContentRouter

type ContentRouter interface {
	FindProviders(ctx context.Context, key cid.Cid) (iter.ResultIter[types.ProviderResponse], error)
	ProvideBitswap(ctx context.Context, req *BitswapWriteProvideRequest) (time.Duration, error)
	Provide(ctx context.Context, req *WriteProvideRequest) (types.ProviderResponse, error)
}

type FindProvidersAsyncResponse

type FindProvidersAsyncResponse struct {
	ProviderResponse types.ProviderResponse
	Error            error
}

type Option

type Option func(s *server)

func WithStreamingResultsDisabled

func WithStreamingResultsDisabled() Option

WithStreamingResultsDisabled disables ndjson responses, so that the server only supports JSON responses.

type WriteProvideRequest

type WriteProvideRequest struct {
	Protocol string
	Schema   string
	Bytes    []byte
}

Jump to

Keyboard shortcuts

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