utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package utils provides SDK state-store access, RPC middleware composition, and legacy encoding helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAnyToInterface

func ConvertAnyToInterface(anyValue *anypb.Any) (any, error)

ConvertAnyToInterface decodes a JSON BytesValue envelope into ordinary Go JSON values. Malformed envelopes or JSON return an error; JSON null produces a nil value without error.

func ConvertInterfaceToAny

func ConvertInterfaceToAny(v any) (*anypb.Any, error)

ConvertInterfaceToAny encodes v as JSON inside a protobuf BytesValue envelope. Unsupported JSON values retain the legacy empty-body behavior; this is not a resource-value codec.

func DeexpandTilde

func DeexpandTilde(path string) string

DeexpandTilde replaces HOME or its lexical path-component prefix with "~". Other paths and failed HOME lookups remain unchanged; it does not resolve symlinks.

func ExpandTilde

func ExpandTilde(path string) (string, error)

ExpandTilde expands paths beginning with "~/" using the current home directory. Other inputs, including empty strings and bare "~", remain unchanged. HOME lookup errors are returned.

func GetPluginStorePath

func GetPluginStorePath(pluginID string) (string, error)

GetPluginStorePath returns a validated store path for an installed plugin. SDK operations use directory handles rather than reopening this advisory path.

func GetStore

func GetStore(capability, pluginID string) (*os.File, error)

GetStore opens a capability store, creating it if needed. The caller closes it.

func InitializePluginStore

func InitializePluginStore(pluginID string) error

InitializePluginStore creates the private store for an installed plugin.

func NewServerInterceptors

func NewServerInterceptors(log logging.Logger) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)

NewServerInterceptors returns the default unary and stream interceptor chains for the plugin SDK gRPC server.

func RegisterServerOpts

func RegisterServerOpts(opts []grpc.ServerOption, log logging.Logger) []grpc.ServerOption

RegisterServerOpts returns a list of gRPC server options with the necessary interceptors for the plugin SDK.

func RemoveStore

func RemoveStore(capability, pluginID string) error

RemoveStore removes only the selected plugin's capability store.

Types

This section is empty.

Directories

Path Synopsis
Package timeutil provides shared time abstractions for deterministic testing.
Package timeutil provides shared time abstractions for deterministic testing.

Jump to

Keyboard shortcuts

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