protocol

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustMarshalAny

func MustMarshalAny(msg proto.Message) *types.Any

MustMarshalAny serializes a protobuf message into an Any or panics.

func NameFromMessage

func NameFromMessage(msg *protocolpb.Message) (string, error)

NameFromMessage extracts the name of the protocol to which the supplied message belongs.

Types

type Instance

type Instance interface {
	HandleMessage(*protocolpb.Message) error
	HasCompleted() bool
}

Instance is the required interface for protocol objects.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry stores running protocols.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) ClearCompleted

func (r *Registry) ClearCompleted()

ClearCopmleted walks the registered protocols and removes those that have completed.

func (*Registry) FindOrAdd

func (r *Registry) FindOrAdd(instID string, ctor func() Instance) Instance

FindOrAdd looks up an existing protocol by instance ID or constructs a new one and registers it under the instance ID indicated.

Jump to

Keyboard shortcuts

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