status

package
v0.1.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Module is a fx module that provides a status Registry and registers status service handlers as grpc-gateway handlers.

func NewErrorDetails

func NewErrorDetails(e error) *statusv1.ErrorDetails

NewErrorDetails is a helper function to create a new instance of ErrorDetails. This recursively fills the cause field from the provided error.

func NewStatus

func NewStatus(d proto.Message, e error) *statusv1.Status

NewStatus creates a new instance of Status to be pushed into status registry. Use this function for creating status instead of by hand. It can either have a detail message or a detail error but not both. This is enforced by first checking for detail message to not be nil.

Types

type KeyMap

type KeyMap map[string][]string

KeyMap is a map of key paths to their correspodning possible traversal paths.

type Registry

type Registry struct {
	statusv1.UnimplementedStatusServiceServer
	// contains filtered or unexported fields
}

Registry holds results.

func NewRegistry

func NewRegistry(delim string) *Registry

NewRegistry returns a new instance of Registry. Delim is the delimiter to use when specifying key paths, e.g., . For "parent.child.key" or / for "parent/child/key".

func (*Registry) Delete

func (reg *Registry) Delete(path string)

Delete removes all nested values from a given path. Clears all keys/values if no path is specified. Every empty, key on the path, is recursively deleted.

func (*Registry) Delim

func (reg *Registry) Delim() string

Delim returns the delimiter used by the Registry.

func (*Registry) Exists

func (reg *Registry) Exists(path string) bool

Exists returns true if the given key path exists in the result map.

func (*Registry) Get

func (reg *Registry) Get(path string) *statusv1.GroupStatus

Get returns the map[string]*Results of a given key path in the Registry. If the key path does not exist, nil is returned.

func (*Registry) GetAllFlat

func (reg *Registry) GetAllFlat() (map[string]*statusv1.GroupStatus, error)

GetAllFlat returns entire flattened map[string]*Results in the Registry.

func (*Registry) GetGroupStatus

func (reg *Registry) GetGroupStatus(ctx context.Context, req *statusv1.GroupStatusRequest) (*statusv1.GroupStatus, error)

GetGroupStatus returns the group status for the requested group in the Registry.

func (*Registry) GetGroups

func (reg *Registry) GetGroups(ctx context.Context, req *emptypb.Empty) (*statusv1.Groups, error)

GetGroups returns the groups from the keys in the Registry.

func (*Registry) Keys

func (reg *Registry) Keys() []string

Keys returns all the keys stored in the Registry keyMap in order.

func (*Registry) Push

func (reg *Registry) Push(path string, status *statusv1.Status) error

Push adds a new result to the provided path.

Jump to

Keyboard shortcuts

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