Documentation
¶
Index ¶
- func ConvertAnyToInterface(anyValue *anypb.Any) (interface{}, error)
- func ConvertInterfaceToAny(v interface{}) (*anypb.Any, error)
- func FromProtoSetting(s *proto.Setting) settings.Setting
- func FromProtoSettingFileSelection(s *proto.SettingFileSelection) *settings.SettingFileSelection
- func ProtoTypeToSettingType(t proto.SettingType) settings.SettingType
- func SettingTypeToProtoType(t settings.SettingType) proto.SettingType
- func ToProtoSetting(s settings.Setting) *proto.Setting
- func ToProtoSettingFileSelection(s *settings.SettingFileSelection) *proto.SettingFileSelection
- type Client
- type Provider
- type SettingsPlugin
- type SettingsPluginServer
- func (s *SettingsPluginServer) GetSetting(_ context.Context, in *proto.GetSettingRequest) (*proto.Setting, error)
- func (s *SettingsPluginServer) GetSettingValue(_ context.Context, in *proto.GetSettingValueRequest) (*proto.GetSettingValueResponse, error)
- func (s *SettingsPluginServer) ListSettings(_ context.Context, _ *emptypb.Empty) (*proto.ListSettingsResponse, error)
- func (s *SettingsPluginServer) SetSetting(_ context.Context, in *proto.SetSettingRequest) (*emptypb.Empty, error)
- func (s *SettingsPluginServer) SetSettings(_ context.Context, in *proto.SetSettingsRequest) (*emptypb.Empty, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAnyToInterface ¶
func ConvertInterfaceToAny ¶
func FromProtoSettingFileSelection ¶
func FromProtoSettingFileSelection(s *proto.SettingFileSelection) *settings.SettingFileSelection
func ProtoTypeToSettingType ¶
func ProtoTypeToSettingType(t proto.SettingType) settings.SettingType
func SettingTypeToProtoType ¶
func SettingTypeToProtoType(t settings.SettingType) proto.SettingType
func ToProtoSettingFileSelection ¶
func ToProtoSettingFileSelection(s *settings.SettingFileSelection) *proto.SettingFileSelection
Types ¶
type Provider ¶
type Provider interface {
// ListSettings returns the settings store
ListSettings() map[string]settings.Setting
// GetSetting returns the setting by ID. This ID should be in the form of a dot separated string
// that represents the path to the setting. For example, "appearance.theme"
GetSetting(id string) (settings.Setting, error)
// GetSettingValue returns the value of the setting by ID
GetSettingValue(id string) (any, error)
// SetSetting sets the value of the setting by ID
SetSetting(id string, value any) error
// SetSettings sets multiple settings at once
SetSettings(settings map[string]any) error
}
Provider is the interface that must be implemented by the settings provider plugin implementations on either side of the RPC.
func NewProviderWrapper ¶
NewProviderWrapper wraps the settings provider to allow for the scoped semantics of using the same setting provider for the core and for the plugins
TODO - this is a bit messy and should be refactored. It'll do for now, as we're just trying to get the plugin system working for the time being.
type SettingsPlugin ¶
type SettingsPlugin struct {
plugin.Plugin
// Concrete implementation, written in Go. This is only used for plugins
// that are written in Go.
Impl Provider
}
This is the implementation of plugin.Plugin so we can serve/consume this.
func (*SettingsPlugin) GRPCClient ¶
func (p *SettingsPlugin) GRPCClient( _ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn, ) (interface{}, error)
func (*SettingsPlugin) GRPCServer ¶
func (p *SettingsPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error
type SettingsPluginServer ¶
type SettingsPluginServer struct {
// This is the real implementation
Impl Provider
}
func (*SettingsPluginServer) GetSetting ¶
func (s *SettingsPluginServer) GetSetting( _ context.Context, in *proto.GetSettingRequest, ) (*proto.Setting, error)
func (*SettingsPluginServer) GetSettingValue ¶
func (s *SettingsPluginServer) GetSettingValue( _ context.Context, in *proto.GetSettingValueRequest, ) (*proto.GetSettingValueResponse, error)
func (*SettingsPluginServer) ListSettings ¶
func (s *SettingsPluginServer) ListSettings( _ context.Context, _ *emptypb.Empty, ) (*proto.ListSettingsResponse, error)
func (*SettingsPluginServer) SetSetting ¶
func (s *SettingsPluginServer) SetSetting( _ context.Context, in *proto.SetSettingRequest, ) (*emptypb.Empty, error)
func (*SettingsPluginServer) SetSettings ¶
func (s *SettingsPluginServer) SetSettings( _ context.Context, in *proto.SetSettingsRequest, ) (*emptypb.Empty, error)
Click to show internal directories.
Click to hide internal directories.