Documentation
¶
Index ¶
- func MarshalFindRequest(r *FindRequest) ([]byte, error)
- func MarshalFindResponse(r *FindResponse) ([]byte, error)
- func MarshalStats(s *Stats) ([]byte, error)
- type ContextualExtendedProviders
- type EncryptedMultihashResult
- type ExtendedProviders
- type FindRequest
- type FindResponse
- type MultihashResult
- type ProviderInfo
- type ProviderResult
- type Stats
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 ¶
MarshalStats serializes the stats response. Currently uses JSON, but could use anything else.
Types ¶
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 []peer.AddrInfo `json:",omitempty"`
Contextual []ContextualExtendedProviders `json:",omitempty"`
Metadatas [][]byte `json:",omitempty"`
}
type FindRequest ¶
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 `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 peer.AddrInfo
LastAdvertisement cid.Cid `json:",omitempty"`
LastAdvertisementTime string `json:",omitempty"`
Lag int `json:",omitempty"`
Publisher *peer.AddrInfo `json:",omitempty"`
IndexCount uint64 `json:",omitempty"`
ExtendedProviders *ExtendedProviders `json:",omitempty"`
FrozenAt cid.Cid `json:",omitempty"`
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"`
}
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 ¶
UnmarshalStats de-serializes the stats response.