Endorsement Store Interface Implementation - #435
Conversation
Definition of protobuf messages used as arguments for endorsement store interface. Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
The store plugin interface definition and implementation of the RPC layer (for go-plugin client and server). Endorsement store interface is an aggregation of IEndorsementStoreReader and IEndorsementStoreWriter, for read and write operations on endorsement store respectively. Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Register endorsementstore targets in the build system and docker deployment. Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
The coserv proxy plugins are now store plugins, with only the ExecuteCoservQuery method implemented. Note: builtin loader may not work. Note: the new stores (amd and nvidia) have not been tested yet. Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Add corimstore based store plugin. The implementation converts existing store implementation into a plugin. Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Update VTS to use the IEndorsementStore interface. Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
q -> %q Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
setrofim
left a comment
There was a problem hiding this comment.
I don't think the notion of a "media type" makes sense in the context of the store backend. We don't really want to be selecting the backend based on it. I also don't like the somewhat arbitrary distinction between "primary" and "fallback" backends.
Suggestion: store backends are identified solely by name; for the sake of reusing existing plugin loader/manager the media type APIs implemented via a shim to to just return the name, and this is hidden as much as possible. Store configuration contains a list of backend names, which specifies which frontend plugins will actually be actively used by the store frontend. When servicing requests, the frontend tries the backends in the order specified until.
|
|
||
| func NewStore() *DefaultStore { | ||
| logger := log.Named(PluginName) | ||
| logger.Debug("initializing default store") |
There was a problem hiding this comment.
This log line belongs inside DefaultStore.Init() below, not here.
|
|
||
| func (s *DefaultStore) Init(params *plugin.Parameters) error { | ||
| if params == nil { | ||
| panic("parameters are required for corimstore") |
There was a problem hiding this comment.
Return an error rather than panic here.
|
|
||
| store, err := corimstore.Open(context.Background(), cfg.StoreConfig()) | ||
| if err != nil { | ||
| panic(err) |
There was a problem hiding this comment.
Return the error rather than panic.
| // initialize it here. | ||
| if strings.Contains(cfg.DSN, ":memory:") { | ||
| if err := store.Init(); err != nil { | ||
| panic(err) |
There was a problem hiding this comment.
Return the error rather than panic.
| return SchemeName | ||
| } | ||
|
|
||
| func (s *DefaultStore) GetSupportedMediaTypes() map[string][]string { |
There was a problem hiding this comment.
I don't think the concept of a "supported media type" really makes sense for a store backend. I think we may want a different plugin interface for this.
| return res, err | ||
| } | ||
|
|
||
| func (s *DefaultStore) ExecuteCoservQuery(mediaType, query string) (*coserv.Coserv, error) { |
There was a problem hiding this comment.
Why does this take a mediaType? It does not appear to be used, and also clashes with remaining store API that takea label instead. The media type should be resolved to a label by the time the request reaches the store.
| } | ||
|
|
||
| func (s CoservProxyHandler) GetEndorsements(tenantID string, query string) ([]byte, error) { | ||
| func (s CoservProxyHandler) ExecuteCoservQuery(mediaType, query string) (*coserv.Coserv, error) { |
There was a problem hiding this comment.
Ditto here. the media type should be resolved by this point.
This PR implements following:
Address issue #431