model

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 ContextualExtendedProviders

type ContextualExtendedProviders struct {
	// Override defines whether chain-level extended providers are used for
	// this ContextID. If true, then the chain-level extended providers are
	// ignored.
	Override bool
	// ContextID defines the context ID that the extended providers have been
	// published for,
	ContextID string
	// Providers contains a list of context-level extended providers IDs and
	// addresses.
	Providers []peer.AddrInfo
	// Metadatas contains a list of content level metadata overrides for this
	// provider.
	Metadatas [][]byte `json:",omitempty"`
}

ContextualExtendedProviders holds information about context-level extended providers. These can either replace or compliment (union) the chain-level extended providers, which is driven by the Override flag.

type EncryptedMultihashResult

type EncryptedMultihashResult struct {
	Multihash          multihash.Multihash `json:"Multihash,omitempty"`
	EncryptedValueKeys [][]byte            `json:"EncryptedValueKeys,omitempty"`
}

EncryptedMultihashResult aggregates all encrypted value keys for a single multihash

type ExtendedProviders

type ExtendedProviders struct {
	// Providers contains a chain-level set of extended providers.
	Providers []peer.AddrInfo `json:",omitempty"`
	// ContextualProviders contains a context-level sets of extended providers.
	Contextual []ContextualExtendedProviders `json:",omitempty"`
	// Metadatas contains a list of metadata overrides for this provider. If
	// extended provider's metadata is not specified then the main provider's
	// metadata is used instead.
	Metadatas [][]byte `json:",omitempty"`
}

ExtendedProviders contains chain-level and context-level extended provider sets.

type FindResponse

type FindResponse struct {
	MultihashResults          []MultihashResult          `json:"MultihashResults,omitempty"`
	EncryptedMultihashResults []EncryptedMultihashResult `json:"EncryptedMultihashResults,omitempty"`
}

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 contains the provider's peer ID and set of Multiaddr addresses
	// that content may be retrieved from.
	AddrInfo peer.AddrInfo
	// LastAdvertisement identifies the latest advertisement the indexer has
	// ingested.
	LastAdvertisement cid.Cid `json:",omitempty"`
	// LastAdvertisementTime is the time the latest advertisement was received.
	LastAdvertisementTime string `json:",omitempty"`
	// Lag is the current sync lag for this provider. A non-zero lag tells us
	// that there is a sync in progress, and how man advertisements that sync
	// has left to complete.
	Lag int `json:",omitempty"`
	// Publisher contains the peer ID and Multiaddr addresses of this
	// provider's advertisement publisher. Content advertisements are available
	// at these addresses.
	Publisher *peer.AddrInfo `json:",omitempty"`
	// ExtendedProviders describes extended providers registered for this
	// provider.
	ExtendedProviders *ExtendedProviders `json:",omitempty"`
	// FrozenAt identifies the last advertisement that was received before the
	// indexer became frozen.
	FrozenAt cid.Cid `json:",omitempty"`
	// FrozenAtTime is the time that the FrozenAt advertisement was received.
	FrozenAtTime string `json:",omitempty"`
	// Inactive means that no update has been received for the configured
	// Discovery.PollInterval, and the publisher is not responding to polls.
	Inactive bool `json:",omitempty"`
	// LastError is a description of the last ingestion error to occur for this
	// provider.
	LastError string `json:",omitempty"`
	// LastErrorTime is the time that LastError occurred.
	LastErrorTime string `json:",omitempty"`
}

ProviderData describes a provider.

type ProviderResult

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

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 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

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