{"modulePath":"github.com/omniviewdev/plugin-sdk","version":"v0.23.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\nPackage utils provides SDK state-store access, RPC middleware composition, and legacy encoding helpers.\n\n## Functions\n\n```go\nfunc ConvertAnyToInterface(anyValue *anypb.Any) (any, error)\n```\nConvertAnyToInterface 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.\n\n```go\nfunc ConvertInterfaceToAny(v any) (*anypb.Any, error)\n```\nConvertInterfaceToAny 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.\n\n```go\nfunc DeexpandTilde(path string) string\n```\nDeexpandTilde replaces HOME or its lexical path-component prefix with \"~\". Other paths and failed HOME lookups remain unchanged; it does not resolve symlinks.\n\n```go\nfunc ExpandTilde(path string) (string, error)\n```\nExpandTilde expands paths beginning with \"~/\" using the current home directory. Other inputs, including empty strings and bare \"~\", remain unchanged. HOME lookup errors are returned.\n\n```go\nfunc GetPluginStorePath(pluginID string) (string, error)\n```\nGetPluginStorePath returns a validated store path for an installed plugin. SDK operations use directory handles rather than reopening this advisory path.\n\n```go\nfunc GetStore(capability, pluginID string) (*os.File, error)\n```\nGetStore opens a capability store, creating it if needed. The caller closes it.\n\n```go\nfunc InitializePluginStore(pluginID string) error\n```\nInitializePluginStore creates the private store for an installed plugin.\n\n```go\nfunc NewServerInterceptors(log logging.Logger) ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)\n```\nNewServerInterceptors returns the default unary and stream interceptor chains for the plugin SDK gRPC server.\n\n```go\nfunc RegisterServerOpts(opts []grpc.ServerOption, log logging.Logger) []grpc.ServerOption\n```\nRegisterServerOpts returns a list of gRPC server options with the necessary interceptors for the plugin SDK.\n\n```go\nfunc RemoveStore(capability, pluginID string) error\n```\nRemoveStore removes only the selected plugin's capability store.\n\n```go\nfunc StreamingMethodFilter() otelgrpc.Filter\n```\nStreamingMethodFilter returns an otelgrpc Filter that skips long-lived streaming RPCs. These streams can run for the entire plugin lifetime and would produce never-ending spans, so they are covered by manual open-phase spans instead. Short-lived unary RPCs are always traced. It is the single list used by both server and client stats handlers.\n\n## Types\n\n```go\ntype StreamObs struct {\n\t// contains filtered or unexported fields\n}\n```\nStreamObs observes one long-lived server stream. The span covers only the open/setup phase; closing the stream records a Debug log and releases the stream gauge. It never records payloads or error text.\n\n```go\nfunc BeginStream(ctx context.Context, log logging.Logger, service, op string) (context.Context, *StreamObs)\n```\nBeginStream starts the \"sdk.\\\u003cservice\u003e.open\" span and registers the stream with the sdk.streams gauge. op must be a vocabulary value accepted by obs.StreamOpened. Call OpenDone or OpenFailed exactly once, then Close.\n\n```go\nfunc (s *StreamObs) Close(ctx context.Context, err error)\n```\nClose releases the stream gauge and logs the classified end of the stream. io.EOF is the normal client close and is reported as a clean end.\n\n```go\nfunc (s *StreamObs) Event(name string, attrs ...attribute.KeyValue)\n```\nEvent adds a bounded event to the open-phase span; it is a no-op after OpenDone.\n\n```go\nfunc (s *StreamObs) OpenDone()\n```\nOpenDone ends the open-phase span successfully.\n\n```go\nfunc (s *StreamObs) OpenFailed(ctx context.Context, err error)\n```\nOpenFailed ends the open-phase span with a classified failure and logs it.\n\n","path":"github.com/omniviewdev/plugin-sdk/pkg/utils","name":"utils","synopsis":"Package utils provides SDK state-store access, RPC middleware composition, and legacy encoding helpers.","isRedistributable":true}
