Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertAnyToInterface(anyValue *anypb.Any) (interface{}, error)
- func ConvertInterfaceToAny(v interface{}) (*anypb.Any, error)
- func DeexpandTilde(path string) string
- func ExpandTilde(path string) (string, error)
- func GetPluginStorePath(pluginID string) (string, error)
- func GetStore(capability, pluginID string) (*os.File, error)
- func InitializePluginStore(pluginID string) error
- func NewServerInterceptors() ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
- func RegisterServerOpts(opts []grpc.ServerOption) []grpc.ServerOption
- func RemoveStore(capability, pluginID string) error
- func ServerPluginContextInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, ...) (interface{}, error)
- func UseServerPluginContext(ctx context.Context) (context.Context, error)
Constants ¶
const (
PluginContextMDKey = "plugin_context"
)
Variables ¶
var ErrNoPluginContextError = errors.New("no plugin context in metadata")
ErrNoPluginContextError is returned when the plugin context is not found in the metadata.
Functions ¶
func ConvertAnyToInterface ¶
func ConvertInterfaceToAny ¶
func DeexpandTilde ¶
DeexpandTilde takes a path and if it is in the home directory, it will replace it with a ~.
func ExpandTilde ¶
ExpandTilde takes a path and if it starts with a ~, it will replace it with the home directory.
func GetPluginStorePath ¶
GetPluginStorePath returns the path to the plugin store for the given plugin.
func GetStore ¶
getStore returns a file handle to the store for the given plugin and capability. If the store does not exist, it will be created. Make sure to close the file handle after using it!
func InitializePluginStore ¶
initializeStore creates the store directory for the given plugin and capability.
func NewServerInterceptors ¶
func NewServerInterceptors() ([]grpc.UnaryServerInterceptor, []grpc.StreamServerInterceptor)
func RegisterServerOpts ¶
func RegisterServerOpts(opts []grpc.ServerOption) []grpc.ServerOption
RegisterServerOpts returns a list of gRPC server options with the necessary interceptors for the plugin SDK.
func RemoveStore ¶
removeStore removes the store for the given plugin and capability.
func ServerPluginContextInterceptor ¶
func ServerPluginContextInterceptor( ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (interface{}, error)
ServerPluginContextInterceptor is a gRPC server interceptor that extracts the plugin context from the metadata and attaches it to the context.
Types ¶
This section is empty.