Documentation
¶
Index ¶
- type BlockSession
- type TrustlessGatewaySession
- func (s *TrustlessGatewaySession) Close() error
- func (s *TrustlessGatewaySession) Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
- func (s *TrustlessGatewaySession) GetSubgraph(ctx context.Context, c cid.Cid, lsys linking.LinkSystem) (int, error)
- func (s *TrustlessGatewaySession) GetSubgraphStream(ctx context.Context, c cid.Cid) (io.ReadCloser, string, error)
- func (s *TrustlessGatewaySession) SeedProviders(ctx context.Context, c cid.Cid)
- func (s *TrustlessGatewaySession) UsedProviders() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockSession ¶
type BlockSession interface {
Get(ctx context.Context, c cid.Cid) (blocks.Block, error)
GetSubgraph(ctx context.Context, c cid.Cid, lsys linking.LinkSystem) (int, error)
// GetSubgraphStream returns a raw CAR stream for the given CID.
// Caller must close the returned ReadCloser.
GetSubgraphStream(ctx context.Context, c cid.Cid) (io.ReadCloser, string, error)
SeedProviders(ctx context.Context, c cid.Cid)
// UsedProviders returns the list of provider endpoints that served blocks
UsedProviders() []string
Close() error
}
BlockSession manages per-block fetching with provider caching.
type TrustlessGatewaySession ¶
type TrustlessGatewaySession struct {
// contains filtered or unexported fields
}
TrustlessGatewaySession implements BlockSession using HTTP trustless gateways. It maintains a cache of providers discovered during block fetching and performs per-block provider discovery when needed.
func NewSession ¶
func NewSession( routing types.CandidateSource, httpClient *http.Client, skipBlockVerification bool, ) *TrustlessGatewaySession
NewSession creates a new TrustlessGatewaySession for per-block HTTP fetching.
func (*TrustlessGatewaySession) Close ¶
func (s *TrustlessGatewaySession) Close() error
func (*TrustlessGatewaySession) GetSubgraph ¶
func (s *TrustlessGatewaySession) GetSubgraph(ctx context.Context, c cid.Cid, lsys linking.LinkSystem) (int, error)
GetSubgraph fetches a subgraph as CAR. Tries providers sequentially (CAR is expensive).
func (*TrustlessGatewaySession) GetSubgraphStream ¶ added in v1.0.0
func (s *TrustlessGatewaySession) GetSubgraphStream(ctx context.Context, c cid.Cid) (io.ReadCloser, string, error)
GetSubgraphStream fetches a subgraph CAR and returns the raw stream. Caller must close the returned ReadCloser.
func (*TrustlessGatewaySession) SeedProviders ¶
func (s *TrustlessGatewaySession) SeedProviders(ctx context.Context, c cid.Cid)
func (*TrustlessGatewaySession) UsedProviders ¶ added in v1.0.0
func (s *TrustlessGatewaySession) UsedProviders() []string
Click to show internal directories.
Click to hide internal directories.