types

package
v0.52.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 16,737

Documentation

Overview

Package types defines a custom wrapper for google.protobuf.Any which supports cached values as well as InterfaceRegistry which keeps track of types which can be used with Any for both security and introspection

Index

Constants

This section is empty.

Variables

NewAnyWithValue is an alias for gogoproto.NewAnyWithCacheWithValue. This function creates a new Any instance containing the provided value, with caching mechanisms to improve performance.

UnsafePackAny is an alias for gogoproto.UnsafePackAnyWithCache. This function packs a given message into an Any type without performing safety checks.

Functions

func MsgTypeURL added in v0.50.0

func MsgTypeURL(msg proto.Message) string

MsgTypeURL returns the TypeURL of a `sdk.Msg`.

func UnpackInterfaces

func UnpackInterfaces(x interface{}, unpacker gogoprotoany.AnyUnpacker) error

UnpackInterfaces is a convenience function that calls UnpackInterfaces on x if x implements UnpackInterfacesMessage

Types

type AminoJSONPacker

type AminoJSONPacker = gogoproto.AminoJSONPacker

AminoJSONPacker is an alias for gogoproto.AminoJSONPacker. It allows for packing data into a JSON format using Amino encoding rules.

type AminoJSONUnpacker

type AminoJSONUnpacker = gogoproto.AminoJSONUnpacker

AminoJSONUnpacker is an alias for gogoproto.AminoJSONUnpacker. It provides the ability to unpack JSON data encoded with Amino encoding rules.

type AminoPacker

type AminoPacker = gogoproto.AminoPacker

AminoPacker is an alias for gogoproto.AminoPacker. It provides functionality for packing and unpacking data using the Amino encoding.

type AminoUnpacker

type AminoUnpacker = gogoproto.AminoUnpacker

AminoUnpacker is an alias for gogoproto.AminoUnpacker. It is used for unpacking Amino-encoded data into Go types.

type Any

type Any = gogoproto.Any

Any is an alias for gogoproto.Any. It represents a protocol buffer message that can contain any arbitrary data. This is used for encoding and decoding unknown or dynamic content in a type-safe manner.

type InterfaceRegistry

type InterfaceRegistry interface {
	gogoprotoany.AnyUnpacker
	jsonpb.AnyResolver
	registry.InterfaceRegistrar

	// ListAllInterfaces list the type URLs of all registered interfaces.
	ListAllInterfaces() []string

	// ListImplementations lists the valid type URLs for the given interface name that can be used
	// for the provided interface type URL.
	ListImplementations(ifaceTypeURL string) []string

	// EnsureRegistered ensures there is a registered interface for the given concrete type.
	EnsureRegistered(iface interface{}) error

	protodesc.Resolver

	// RangeFiles iterates over all registered files and calls f on each one. This
	// implements the part of protoregistry.Files that is needed for reflecting over
	// the entire FileDescriptorSet.
	RangeFiles(f func(protoreflect.FileDescriptor) bool)

	SigningContext() *signing.Context
	// contains filtered or unexported methods
}

InterfaceRegistry provides a mechanism for registering interfaces and implementations that can be safely unpacked from Any

func NewInterfaceRegistry

func NewInterfaceRegistry() InterfaceRegistry

NewInterfaceRegistry returns a new InterfaceRegistry

func NewInterfaceRegistryWithOptions added in v0.50.0

func NewInterfaceRegistryWithOptions(options InterfaceRegistryOptions) (InterfaceRegistry, error)

NewInterfaceRegistryWithOptions returns a new InterfaceRegistry with the given options.

type InterfaceRegistryOptions added in v0.50.0

type InterfaceRegistryOptions struct {
	// ProtoFiles is the set of files to use for the registry. It is required.
	ProtoFiles signing.ProtoFileResolver

	// SigningOptions are the signing options to use for the registry.
	SigningOptions signing.Options
}

InterfaceRegistryOptions are options for creating a new InterfaceRegistry.

type ProtoJSONPacker added in v0.40.0

type ProtoJSONPacker = gogoproto.ProtoJSONPacker

ProtoJSONPacker is an alias for gogoproto.ProtoJSONPacker. This is used for packing protocol buffer messages into a JSON format.

Jump to

Keyboard shortcuts

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