service

package
v0.1.0-alpha.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvelopeDomain      = "ww/registry/location"
	EnvelopePayloadType = []byte{0x1f, 0x01}
	ErrInavlidType      = errors.New("invalid type")
)
View Source
var ErrInvalidSignature = errors.New("invalid signature")

Functions

This section is empty.

Types

type Location

type Location struct {
	api.Location
}

func NewLocation

func NewLocation() (Location, error)

func (Location) Codec

func (loc Location) Codec() []byte

Codec is a binary identifier for this type of record, ideally a registered multicodec (see https://github.com/multiformats/multicodec). When a Record is put into an Envelope (see record.Seal), the Codec value will be used as the Envelope's PayloadType. When the Envelope is later unsealed, the PayloadType will be used to lookup the correct Record type to unmarshal the Envelope payload into.

func (Location) Domain

func (loc Location) Domain() string

Domain is the "signature domain" used when signing and verifying a particular Record type. The Domain string should be unique to your Record type, and all instances of the Record type must have the same Domain string.

func (Location) Maddrs

func (loc Location) Maddrs() ([]ma.Multiaddr, error)

func (Location) MarshalRecord

func (loc Location) MarshalRecord() ([]byte, error)

MarshalRecord converts a Record instance to a []byte, so that it can be used as an Envelope payload.

func (Location) SetAnchor

func (loc Location) SetAnchor(anchor string) error

func (Location) SetCustom

func (loc Location) SetCustom(custom capnp.Ptr) error

func (Location) SetMaddrs

func (loc Location) SetMaddrs(maddrs []ma.Multiaddr) error

func (*Location) UnmarshalRecord

func (loc *Location) UnmarshalRecord(b []byte) error

UnmarshalRecord unmarshals a []byte payload into an instance of a particular Record type.

func (Location) Validate

func (loc Location) Validate(topic string) error

type Registry

type Registry api.Registry

func (Registry) FindProviders

func (c Registry) FindProviders(ctx context.Context, topic pubsub.Topic) (casm.Iterator[Location], capnp.ReleaseFunc)

func (Registry) Provide

func (c Registry) Provide(ctx context.Context, topic pubsub.Topic, e *record.Envelope) (casm.Future, capnp.ReleaseFunc)

func (Registry) Release

func (c Registry) Release()

type RegistryServer

type RegistryServer struct{}

func (*RegistryServer) Client

func (s *RegistryServer) Client() capnp.Client

func (*RegistryServer) FindProviders

func (s *RegistryServer) FindProviders(ctx context.Context, call api.Registry_findProviders) error

func (*RegistryServer) Provide

func (s *RegistryServer) Provide(ctx context.Context, call api.Registry_provide) error

type Server

type Server struct{}

func (Server) Registry

func (s Server) Registry() Registry

Jump to

Keyboard shortcuts

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