model

package
v0.0.0-...-403c8b4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalFindRequest

func MarshalFindRequest(r *FindRequest) ([]byte, error)

MarshalFindRequest serializes the request. Currently uses JSON, but could use anything else.

NOTE: Consider using other serialization formats? We could maybe use IPLD schemas instead of structs for requests and response so we have any codec by design.

func MarshalFindResponse

func MarshalFindResponse(r *FindResponse) ([]byte, error)

MarshalFindResponse serializes a find response.

func MarshalStats

func MarshalStats(s *Stats) ([]byte, error)

MarshalStats serializes the stats response. Currently uses JSON, but could use anything else.

Types

type FindRequest

type FindRequest struct {
	Multihashes []multihash.Multihash
}

FindRequest is the client request send by end user clients

func UnmarshalFindRequest

func UnmarshalFindRequest(b []byte) (*FindRequest, error)

UnmarshalFindRequest de-serializes the request.

type FindResponse

type FindResponse struct {
	MultihashResults []MultihashResult
}

FindResponse used to answer client queries/requests

func UnmarshalFindResponse

func UnmarshalFindResponse(b []byte) (*FindResponse, error)

UnmarshalFindResponse de-serializes a find response.

func (*FindResponse) PrettyPrint

func (r *FindResponse) PrettyPrint()

PrettyPrint a response for CLI output

func (*FindResponse) String

func (r *FindResponse) String() string

type MultihashResult

type MultihashResult struct {
	Multihash       multihash.Multihash
	ProviderResults []ProviderResult
}

MultihashResult aggregates all values for a single multihash.

type ProviderInfo

type ProviderInfo struct {
	AddrInfo              peer.AddrInfo
	LastAdvertisement     cid.Cid        `json:",omitempty"`
	LastAdvertisementTime string         `json:",omitempty"`
	Publisher             *peer.AddrInfo `json:",omitempty"`
}

ProviderData describes a provider.

func MakeProviderInfo

func MakeProviderInfo(addrInfo peer.AddrInfo, lastAd cid.Cid, lastAdTime time.Time, publisherID peer.ID, publisherAddr multiaddr.Multiaddr) ProviderInfo

type ProviderResult

type ProviderResult struct {
	// ContextID identifies the metadata that is part of this value.
	ContextID []byte
	// Metadata contains information for the provider to use to retrieve data.
	Metadata []byte
	// Provider is the peer ID and addresses of the provider.
	Provider peer.AddrInfo
}

ProviderResult is a one of possibly multiple results when looking up a provider of indexed context.

func (ProviderResult) Equal

func (pr ProviderResult) Equal(other ProviderResult) bool

Equal compares ProviderResult values to determine if they are equal. The provider addresses are omitted from the comparison.

type Stats

type Stats struct {
	EntriesEstimate int64
}

Stats is the client response to a stats request.

func UnmarshalStats

func UnmarshalStats(b []byte) (*Stats, error)

UnmarshalStats de-serializes the stats response.

Jump to

Keyboard shortcuts

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