resolver

package
v0.0.0-...-f507469 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OptionAll = "__ALL__"
	// TODO: Layout the ground work for resolver configurations
	// allowing a user to set the default autocomplete limit
	DefaultAutocompleteLimit = 50
)
View Source
const TypePrefix = "type.googleapis.com/"

Variables

View Source
var Registry = map[string]Resolver{}

Functions

func HydrateDynamicOptions

func HydrateDynamicOptions(schemas TypeURLToSchemasMap, options map[string][]*resolverv1.Option)

func MarshalProtoSlice

func MarshalProtoSlice(pbs interface{}) ([]*anypb.Any, error)

func MessageSlice

func MessageSlice(s interface{}) []proto.Message

MessageSlice takes a slice of protobuf objects and converts them to a slice of generic protobuf Messages.

func TypeURL deprecated

func TypeURL(m protodeprecated.Message) string

Deprecated: use meta.TypeURL instead, will require moving to new proto APIs.

Types

type Factory

type Factory map[string]func(*anypb.Any, *zap.Logger, tally.Scope) (Resolver, error)

type FanoutHandler

type FanoutHandler interface {
	Add(delta int)
	Done()

	Cancelled() <-chan struct{}
	Channel() chan<- FanoutResult

	Results(limit uint32) (*Results, error)
}

func NewFanoutHandler

func NewFanoutHandler(ctx context.Context) (context.Context, FanoutHandler)

type FanoutResult

type FanoutResult struct {
	Messages []proto.Message
	Err      error
}

func NewFanoutResult

func NewFanoutResult(pbSlice interface{}, err error) FanoutResult

func NewSingleFanoutResult

func NewSingleFanoutResult(message proto.Message, err error) FanoutResult

type Resolver

type Resolver interface {
	Schemas() TypeURLToSchemasMap

	Search(ctx context.Context, typeURL, query string, limit uint32) (*Results, error)

	Resolve(ctx context.Context, typeURL string, input protodeprecated.Message, limit uint32) (*Results, error)

	Autocomplete(ctx context.Context, typeURL, search string, limit uint64, caseSensitive bool) ([]*resolverv1.AutocompleteResult, error)
}

type Results

type Results struct {
	Messages        []proto.Message
	PartialFailures []*status.Status
}

type TypeURLToSchemaMessagesMap

type TypeURLToSchemaMessagesMap map[string][]proto.Message

Input map from resolvers with the type URL of the resolved object mapped to the schema's message. e.g. {"v1.Instance": [v1.Name, v1.IPAddress]}

type TypeURLToSchemasMap

type TypeURLToSchemasMap map[string][]*resolverv1.Schema

Output map used by the resolver after the input TypeURLToSchemaMessagesMap was used to read metadata from the protobuf objects. e.g. {"v1.Instance": [{"DisplayName": "Name", "Searchable": true}, {"DisplayName": "IP Address", "Searchable": true}]}

func InputsToSchemas

func InputsToSchemas(typeSchemas TypeURLToSchemaMessagesMap) (TypeURLToSchemasMap, error)

Pass in annotated resolver input objects and return schemas for them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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