Documentation
¶
Index ¶
- type Controller
- type ServiceWrapper
- func (s *ServiceWrapper) CompareAndSwap(pluginID, key, expectedRevision string, value any) (bool, error)
- func (s *ServiceWrapper) Delete(pluginID, key string) error
- func (s *ServiceWrapper) Get(pluginID, key string) (any, error)
- func (s *ServiceWrapper) GetSnapshot(pluginID, key string) (Snapshot, 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
- type Snapshot
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)
GetSnapshot(pluginID, key string) (Snapshot, error)
CompareAndSwap(pluginID, key, expectedRevision string, value any) (bool, 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) CompareAndSwap ¶ added in v0.29.0
func (s *ServiceWrapper) CompareAndSwap(pluginID, key, expectedRevision string, value any) (bool, error)
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) GetSnapshot ¶ added in v0.29.0
func (s *ServiceWrapper) GetSnapshot(pluginID, key string) (Snapshot, 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