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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DiscoverRequestEnvelopeDomain = "indexer-discover-request-record"

DiscoverRequestEnvelopeDomain is the domain string used for discover requests contained in a Envelope

View Source
const IngestRequestEnvelopeDomain = "indexer-ingest-request-record"

IngestRequestEnvelopeDomain is the domain string used for ingest requests contained in a Envelope.

Variables

View Source
var DiscoverRequestEnvelopePayloadType = []byte("indexer-discover-request")

DiscoverRequestEnvelopePayloadType is the type hint used to identify DiscoverRequest records in a Envelope.

View Source
var IngestRequestEnvelopePayloadType = []byte("indexer-ingest-request")

IngestRequestEnvelopePayloadType is the type hint used to identify IngestRequest records in a Envelope.

Functions

func MakeDiscoverRequest

func MakeDiscoverRequest(providerID peer.ID, privateKey crypto.PrivKey, discoveryAddr string) ([]byte, error)

MakeDiscoverRequest creates a signed DiscoverRequest and marshals it into bytes

func MakeIngestRequest

func MakeIngestRequest(providerID peer.ID, privateKey crypto.PrivKey, m multihash.Multihash, contextID []byte, metadata []byte, addrs []string) ([]byte, error)

MakeIngestRequest creates a signed IngestRequest and marshals it into bytes

func MakeRegisterRequest

func MakeRegisterRequest(providerID peer.ID, privateKey crypto.PrivKey, addrs []string) ([]byte, error)

MakeRegisterRequest creates a signed peer.PeerRecord as a register request and marshals this into bytes

func ReadRegisterRequest

func ReadRegisterRequest(data []byte) (*peer.PeerRecord, error)

ReadRegisterRequest unmarshals a peer.PeerRequest from bytes, verifies the signature, and returns a peer.PeerRecord

Types

type DiscoverRequest

type DiscoverRequest struct {
	ProviderID    peer.ID
	DiscoveryAddr string
	Seq           uint64
}

func ReadDiscoverRequest

func ReadDiscoverRequest(data []byte) (*DiscoverRequest, error)

ReadDiscoverRequest unmarshals a DiscoverRequest from bytes, verifies the signature, and returns the DiscoverRequest

func (*DiscoverRequest) Codec

func (r *DiscoverRequest) Codec() []byte

Codec is a binary identifier for the DiscoverRequest type

func (*DiscoverRequest) Domain

func (r *DiscoverRequest) Domain() string

Domain is used when signing and validating DiscoverRequest records contained in Envelopes

func (*DiscoverRequest) MarshalRecord

func (r *DiscoverRequest) MarshalRecord() ([]byte, error)

MarshalRecord serializes an DiscoverRequesr to a byte slice.

func (*DiscoverRequest) UnmarshalRecord

func (r *DiscoverRequest) UnmarshalRecord(data []byte) error

UnmarshalRecord parses a DiscoverRequest from a byte slice

type IngestRequest

type IngestRequest struct {
	Multihash  multihash.Multihash
	ProviderID peer.ID
	ContextID  []byte
	Metadata   []byte
	Addrs      []string
	Seq        uint64
}

IgenstRequest is a request to store a single multihash. This is intentionally limited to one multihash as bulk ingestion should be done via advertisement ingestion method.

func ReadIngestRequest

func ReadIngestRequest(data []byte) (*IngestRequest, error)

ReadIngestRequest unmarshals an IngestRequest from bytes, verifies the signature, and returns the IngestRequest

func (*IngestRequest) Codec

func (r *IngestRequest) Codec() []byte

Codec is a binary identifier for the IngestRequest type

func (*IngestRequest) Domain

func (r *IngestRequest) Domain() string

Domain is used when signing and validating IngestRequest records contained in Envelopes

func (*IngestRequest) MarshalRecord

func (r *IngestRequest) MarshalRecord() ([]byte, error)

MarshalRecord serializes an IngestRequesr to a byte slice.

func (*IngestRequest) UnmarshalRecord

func (r *IngestRequest) UnmarshalRecord(data []byte) error

UnmarshalRecord parses an IngestRequest from a byte slice.

Jump to

Keyboard shortcuts

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