forked from containerd/containerd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
39 lines (32 loc) · 871 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"
empty "github.com/golang/protobuf/ptypes/empty"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
var _ api.VersionServer = &Service{}
func init() {
plugin.Register(&plugin.Registration{
Type: plugin.GRPCPlugin,
ID: "version",
Init: New,
})
}
func New(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, _ *empty.Empty) (*api.VersionResponse, error) {
return &api.VersionResponse{
Version: ctrdversion.Version,
Revision: ctrdversion.Revision,
}, nil
}