forked from containerd/containerd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
39 lines (32 loc) · 880 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package version
import (
api "github.com/containerd/containerd/api/services/version/v1"
"github.com/containerd/containerd/plugin"
ctrdversion "github.com/containerd/containerd/version"
ptypes "github.com/gogo/protobuf/types"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
var _ api.VersionServer = &service{}
func init() {
plugin.Register(&plugin.Registration{
Type: plugin.GRPCPlugin,
ID: "version",
InitFn: initFunc,
})
}
func initFunc(ic *plugin.InitContext) (interface{}, error) {
return &service{}, nil
}
type service struct {
}
func (s *service) Register(server *grpc.Server) error {
api.RegisterVersionServer(server, s)
return nil
}
func (s *service) Version(ctx context.Context, _ *ptypes.Empty) (*api.VersionResponse, error) {
return &api.VersionResponse{
Version: ctrdversion.Version,
Revision: ctrdversion.Revision,
}, nil
}