Add ttrpc generated services
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
60
api/services/diff/v1/diff_ttrpc.pb.go
Normal file
60
api/services/diff/v1/diff_ttrpc.pb.go
Normal file
@@ -0,0 +1,60 @@
|
||||
// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
|
||||
// source: github.com/containerd/containerd/api/services/diff/v1/diff.proto
|
||||
package diff
|
||||
|
||||
import (
|
||||
context "context"
|
||||
ttrpc "github.com/containerd/ttrpc"
|
||||
)
|
||||
|
||||
type TTRPCDiffService interface {
|
||||
Apply(context.Context, *ApplyRequest) (*ApplyResponse, error)
|
||||
Diff(context.Context, *DiffRequest) (*DiffResponse, error)
|
||||
}
|
||||
|
||||
func RegisterTTRPCDiffService(srv *ttrpc.Server, svc TTRPCDiffService) {
|
||||
srv.RegisterService("containerd.services.diff.v1.Diff", &ttrpc.ServiceDesc{
|
||||
Methods: map[string]ttrpc.Method{
|
||||
"Apply": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req ApplyRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.Apply(ctx, &req)
|
||||
},
|
||||
"Diff": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
||||
var req DiffRequest
|
||||
if err := unmarshal(&req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return svc.Diff(ctx, &req)
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
type ttrpcdiffClient struct {
|
||||
client *ttrpc.Client
|
||||
}
|
||||
|
||||
func NewTTRPCDiffClient(client *ttrpc.Client) TTRPCDiffService {
|
||||
return &ttrpcdiffClient{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ttrpcdiffClient) Apply(ctx context.Context, req *ApplyRequest) (*ApplyResponse, error) {
|
||||
var resp ApplyResponse
|
||||
if err := c.client.Call(ctx, "containerd.services.diff.v1.Diff", "Apply", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (c *ttrpcdiffClient) Diff(ctx context.Context, req *DiffRequest) (*DiffResponse, error) {
|
||||
var resp DiffResponse
|
||||
if err := c.client.Call(ctx, "containerd.services.diff.v1.Diff", "Diff", req, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
Reference in New Issue
Block a user