
To gather metrics/stats about a specific sandbox instance, it'd be nice to have a dedicated rpc for this. Due to the same "what kind of stats are going to be returned" dilemma exists for sandboxes as well, I've re-used the metrics type we have as the data field is just an `any`, leaving the metrics returned entirely up to the shim author. For CRI usecases this will just be cgroup and windows stats as that's all that's supported right now. Signed-off-by: Danny Canter <danny@dcantah.dev>
173 lines
6.3 KiB
Go
173 lines
6.3 KiB
Go
// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
|
|
// source: github.com/containerd/containerd/api/runtime/sandbox/v1/sandbox.proto
|
|
package sandbox
|
|
|
|
import (
|
|
context "context"
|
|
ttrpc "github.com/containerd/ttrpc"
|
|
)
|
|
|
|
type TTRPCSandboxService interface {
|
|
CreateSandbox(context.Context, *CreateSandboxRequest) (*CreateSandboxResponse, error)
|
|
StartSandbox(context.Context, *StartSandboxRequest) (*StartSandboxResponse, error)
|
|
Platform(context.Context, *PlatformRequest) (*PlatformResponse, error)
|
|
StopSandbox(context.Context, *StopSandboxRequest) (*StopSandboxResponse, error)
|
|
WaitSandbox(context.Context, *WaitSandboxRequest) (*WaitSandboxResponse, error)
|
|
SandboxStatus(context.Context, *SandboxStatusRequest) (*SandboxStatusResponse, error)
|
|
PingSandbox(context.Context, *PingRequest) (*PingResponse, error)
|
|
ShutdownSandbox(context.Context, *ShutdownSandboxRequest) (*ShutdownSandboxResponse, error)
|
|
SandboxMetrics(context.Context, *SandboxMetricsRequest) (*SandboxMetricsResponse, error)
|
|
}
|
|
|
|
func RegisterTTRPCSandboxService(srv *ttrpc.Server, svc TTRPCSandboxService) {
|
|
srv.RegisterService("containerd.runtime.sandbox.v1.Sandbox", &ttrpc.ServiceDesc{
|
|
Methods: map[string]ttrpc.Method{
|
|
"CreateSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req CreateSandboxRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.CreateSandbox(ctx, &req)
|
|
},
|
|
"StartSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req StartSandboxRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.StartSandbox(ctx, &req)
|
|
},
|
|
"Platform": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req PlatformRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.Platform(ctx, &req)
|
|
},
|
|
"StopSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req StopSandboxRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.StopSandbox(ctx, &req)
|
|
},
|
|
"WaitSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req WaitSandboxRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.WaitSandbox(ctx, &req)
|
|
},
|
|
"SandboxStatus": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req SandboxStatusRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.SandboxStatus(ctx, &req)
|
|
},
|
|
"PingSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req PingRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.PingSandbox(ctx, &req)
|
|
},
|
|
"ShutdownSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req ShutdownSandboxRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.ShutdownSandbox(ctx, &req)
|
|
},
|
|
"SandboxMetrics": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
|
|
var req SandboxMetricsRequest
|
|
if err := unmarshal(&req); err != nil {
|
|
return nil, err
|
|
}
|
|
return svc.SandboxMetrics(ctx, &req)
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
type ttrpcsandboxClient struct {
|
|
client *ttrpc.Client
|
|
}
|
|
|
|
func NewTTRPCSandboxClient(client *ttrpc.Client) TTRPCSandboxService {
|
|
return &ttrpcsandboxClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) CreateSandbox(ctx context.Context, req *CreateSandboxRequest) (*CreateSandboxResponse, error) {
|
|
var resp CreateSandboxResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "CreateSandbox", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) StartSandbox(ctx context.Context, req *StartSandboxRequest) (*StartSandboxResponse, error) {
|
|
var resp StartSandboxResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "StartSandbox", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) Platform(ctx context.Context, req *PlatformRequest) (*PlatformResponse, error) {
|
|
var resp PlatformResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "Platform", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) StopSandbox(ctx context.Context, req *StopSandboxRequest) (*StopSandboxResponse, error) {
|
|
var resp StopSandboxResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "StopSandbox", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) WaitSandbox(ctx context.Context, req *WaitSandboxRequest) (*WaitSandboxResponse, error) {
|
|
var resp WaitSandboxResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "WaitSandbox", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) SandboxStatus(ctx context.Context, req *SandboxStatusRequest) (*SandboxStatusResponse, error) {
|
|
var resp SandboxStatusResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "SandboxStatus", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) PingSandbox(ctx context.Context, req *PingRequest) (*PingResponse, error) {
|
|
var resp PingResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "PingSandbox", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) ShutdownSandbox(ctx context.Context, req *ShutdownSandboxRequest) (*ShutdownSandboxResponse, error) {
|
|
var resp ShutdownSandboxResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "ShutdownSandbox", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
func (c *ttrpcsandboxClient) SandboxMetrics(ctx context.Context, req *SandboxMetricsRequest) (*SandboxMetricsResponse, error) {
|
|
var resp SandboxMetricsResponse
|
|
if err := c.client.Call(ctx, "containerd.runtime.sandbox.v1.Sandbox", "SandboxMetrics", req, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|