Setup plugin ids and dependencies

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-08 09:45:22 -07:00
parent 6bbed2c125
commit 94e7f8e943
31 changed files with 331 additions and 319 deletions

View File

@@ -30,15 +30,23 @@ var bufPool = sync.Pool{
var _ api.ContentServer = &Service{}
func init() {
plugin.Register("content-grpc", &plugin.Registration{
plugin.Register(&plugin.Registration{
Type: plugin.GRPCPlugin,
ID: "content",
Requires: []plugin.PluginType{
plugin.ContentPlugin,
},
Init: NewService,
})
}
func NewService(ic *plugin.InitContext) (interface{}, error) {
c, err := ic.Get(plugin.ContentPlugin)
if err != nil {
return nil, err
}
return &Service{
store: ic.Content,
store: c.(content.Store),
}, nil
}