Documentation
¶
Index ¶
- type Controller
- type ServiceWrapper
- func (s *ServiceWrapper) Delete(pluginID, key string) error
- func (s *ServiceWrapper) Get(pluginID, key string) (any, error)
- func (s *ServiceWrapper) Keys(pluginID string) ([]string, error)
- func (s *ServiceWrapper) ServiceShutdown() error
- func (s *ServiceWrapper) ServiceStartup(ctx context.Context, options application.ServiceOptions) error
- func (s *ServiceWrapper) Set(pluginID, key string, value any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface {
ServiceStartup(ctx context.Context, options application.ServiceOptions) error
ServiceShutdown() error
Get(pluginID, key string) (any, error)
Set(pluginID, key string, value any) error
Delete(pluginID, key string) error
Keys(pluginID string) ([]string, error)
}
Controller provides a JSON key-value store for plugins to persist arbitrary data. Each key is stored as a separate JSON file under <stateRoot>/plugins/{pluginID}/data/.
func NewController ¶
func NewController(logger logging.Logger, pluginDataFn func(string) (*appstate.ScopedRoot, error)) Controller
NewController creates a new data store controller. pluginDataFn returns a ScopedRoot for the given plugin's data directory.
type ServiceWrapper ¶ added in v0.4.0
type ServiceWrapper struct {
Ctrl Controller
}
ServiceWrapper is an explicit delegation wrapper around data.Controller.
func (*ServiceWrapper) Delete ¶ added in v0.4.0
func (s *ServiceWrapper) Delete(pluginID, key string) error
func (*ServiceWrapper) Get ¶ added in v0.4.0
func (s *ServiceWrapper) Get(pluginID, key string) (any, error)
func (*ServiceWrapper) Keys ¶ added in v0.4.0
func (s *ServiceWrapper) Keys(pluginID string) ([]string, error)
func (*ServiceWrapper) ServiceShutdown ¶ added in v0.4.0
func (s *ServiceWrapper) ServiceShutdown() error
func (*ServiceWrapper) ServiceStartup ¶ added in v0.4.0
func (s *ServiceWrapper) ServiceStartup(ctx context.Context, options application.ServiceOptions) error