model

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0, MIT Imports: 10 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 added in v0.4.18

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

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

Types

type ContextualExtendedProviders added in v0.5.0

type ContextualExtendedProviders struct {
	Override  bool
	ContextID string
	Providers []peer.AddrInfo
}

type ExtendedProviders added in v0.5.0

type ExtendedProviders struct {
	Providers  []peer.AddrInfo               `json:",omitempty"`
	Contextual []ContextualExtendedProviders `json:",omitempty"`
}

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 added in v0.3.0

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

ProviderData describes a provider.

func MakeProviderInfo added in v0.3.0

func MakeProviderInfo(addrInfo peer.AddrInfo, lastAd cid.Cid, lastAdTime time.Time, publisherID peer.ID, publisherAddr multiaddr.Multiaddr, indexCount uint64) 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 added in v0.4.18

type Stats struct {

	// EntriesEstimate estimates the number of entries by simply dividing the size of valuestore by
	// a constant (40). Warning: this estimation does not take into account the backing store
	// optimisations such as compression an prefixed-based storage which could significantly reduce
	// size on disk.
	EntriesEstimate int64
	// EntriesCount uses the backing store API whenever possible to count the number of unique
	// entries in the value store. Its value is not an exact count. It is considered to be far more
	// accurate than estimates based on size of valuestore, e.g. EntriesEstimate.
	EntriesCount int64
}

Stats is the client response to a stats request.

func UnmarshalStats added in v0.4.18

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