Add sandbox store plugin type

Moves the sandbox store plugin under the plugins packages and adds a
unique plugin type for other plugins to depend on it.
Updates the sandbox controller plugin to depend on the sandbox store
plugin.

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2022-12-20 17:46:38 -08:00
parent dd5605e444
commit 47fee791f6
8 changed files with 100 additions and 144 deletions

View File

@@ -166,9 +166,9 @@ func WithIntrospectionService(in introspection.Service) ServicesOpt {
}
// WithSandboxStore sets the sandbox store.
func WithSandboxStore(client sandboxapi.StoreClient) ServicesOpt {
func WithSandboxStore(client sandbox.Store) ServicesOpt {
return func(s *services) {
s.sandboxStore = proxy.NewSandboxStore(client)
s.sandboxStore = client
}
}
@@ -191,6 +191,9 @@ func WithInMemoryServices(ic *plugin.InitContext) ClientOpt {
plugin.LeasePlugin: func(i interface{}) ServicesOpt {
return WithLeasesService(i.(leases.Manager))
},
plugin.SandboxStorePlugin: func(i interface{}) ServicesOpt {
return WithSandboxStore(i.(sandbox.Store))
},
} {
i, err := ic.Get(t)
if err != nil {
@@ -228,9 +231,6 @@ func WithInMemoryServices(ic *plugin.InitContext) ClientOpt {
srv.IntrospectionService: func(s interface{}) ServicesOpt {
return WithIntrospectionClient(s.(introspectionapi.IntrospectionClient))
},
srv.SandboxStoreService: func(s interface{}) ServicesOpt {
return WithSandboxStore(s.(sandboxapi.StoreClient))
},
srv.SandboxControllerService: func(s interface{}) ServicesOpt {
return WithSandboxController(s.(sandboxapi.ControllerClient))
},