server

package
v0.0.0-...-fcfc175 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContainerState_name = map[int32]string{
		0: "CREATED",
		1: "RUNNING",
		2: "EXITED",
		3: "UNKNOW",
	}
	ContainerState_value = map[string]int32{
		"CREATED": 0,
		"RUNNING": 1,
		"EXITED":  2,
		"UNKNOW":  3,
	}
)

Enum value maps for ContainerState.

View Source
var Cri_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Cri",
	HandlerType: (*CriServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Version",
			Handler:    _Cri_Version_Handler,
		},
		{
			MethodName: "CreateContainer",
			Handler:    _Cri_CreateContainer_Handler,
		},
		{
			MethodName: "StartContainer",
			Handler:    _Cri_StartContainer_Handler,
		},
		{
			MethodName: "StopContainer",
			Handler:    _Cri_StopContainer_Handler,
		},
		{
			MethodName: "RemoveContainer",
			Handler:    _Cri_RemoveContainer_Handler,
		},
		{
			MethodName: "ListContainers",
			Handler:    _Cri_ListContainers_Handler,
		},
		{
			MethodName: "ContainerStatus",
			Handler:    _Cri_ContainerStatus_Handler,
		},
		{
			MethodName: "Attach",
			Handler:    _Cri_Attach_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "cri.proto",
}

Cri_ServiceDesc is the grpc.ServiceDesc for Cri service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterCriServer

func RegisterCriServer(s grpc.ServiceRegistrar, srv CriServer)

Types

type AttachRequest

type AttachRequest struct {
	ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	Tty         bool   `protobuf:"varint,2,opt,name=tty,proto3" json:"tty,omitempty"`
	Stdin       bool   `protobuf:"varint,3,opt,name=stdin,proto3" json:"stdin,omitempty"`
	Stdout      bool   `protobuf:"varint,4,opt,name=stdout,proto3" json:"stdout,omitempty"`
	Stderr      bool   `protobuf:"varint,5,opt,name=stderr,proto3" json:"stderr,omitempty"`
	// contains filtered or unexported fields
}

func (*AttachRequest) Descriptor deprecated

func (*AttachRequest) Descriptor() ([]byte, []int)

Deprecated: Use AttachRequest.ProtoReflect.Descriptor instead.

func (*AttachRequest) GetContainerId

func (x *AttachRequest) GetContainerId() string

func (*AttachRequest) GetStderr

func (x *AttachRequest) GetStderr() bool

func (*AttachRequest) GetStdin

func (x *AttachRequest) GetStdin() bool

func (*AttachRequest) GetStdout

func (x *AttachRequest) GetStdout() bool

func (*AttachRequest) GetTty

func (x *AttachRequest) GetTty() bool

func (*AttachRequest) ProtoMessage

func (*AttachRequest) ProtoMessage()

func (*AttachRequest) ProtoReflect

func (x *AttachRequest) ProtoReflect() protoreflect.Message

func (*AttachRequest) Reset

func (x *AttachRequest) Reset()

func (*AttachRequest) String

func (x *AttachRequest) String() string

type AttachResponse

type AttachResponse struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

func (*AttachResponse) Descriptor deprecated

func (*AttachResponse) Descriptor() ([]byte, []int)

Deprecated: Use AttachResponse.ProtoReflect.Descriptor instead.

func (*AttachResponse) GetUrl

func (x *AttachResponse) GetUrl() string

func (*AttachResponse) ProtoMessage

func (*AttachResponse) ProtoMessage()

func (*AttachResponse) ProtoReflect

func (x *AttachResponse) ProtoReflect() protoreflect.Message

func (*AttachResponse) Reset

func (x *AttachResponse) Reset()

func (*AttachResponse) String

func (x *AttachResponse) String() string

type Container

type Container struct {
	Id   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// Unix time 纳秒
	CreatedAt int64          `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	State     ContainerState `protobuf:"varint,4,opt,name=state,proto3,enum=ContainerState" json:"state,omitempty"`
	// contains filtered or unexported fields
}

func (*Container) Descriptor deprecated

func (*Container) Descriptor() ([]byte, []int)

Deprecated: Use Container.ProtoReflect.Descriptor instead.

func (*Container) GetCreatedAt

func (x *Container) GetCreatedAt() int64

func (*Container) GetId

func (x *Container) GetId() string

func (*Container) GetName

func (x *Container) GetName() string

func (*Container) GetState

func (x *Container) GetState() ContainerState

func (*Container) ProtoMessage

func (*Container) ProtoMessage()

func (*Container) ProtoReflect

func (x *Container) ProtoReflect() protoreflect.Message

func (*Container) Reset

func (x *Container) Reset()

func (*Container) String

func (x *Container) String() string

type ContainerState

type ContainerState int32
const (
	ContainerState_CREATED ContainerState = 0
	ContainerState_RUNNING ContainerState = 1
	ContainerState_EXITED  ContainerState = 2
	ContainerState_UNKNOW  ContainerState = 3
)

func (ContainerState) Descriptor

func (ContainerState) Enum

func (x ContainerState) Enum() *ContainerState

func (ContainerState) EnumDescriptor deprecated

func (ContainerState) EnumDescriptor() ([]byte, []int)

Deprecated: Use ContainerState.Descriptor instead.

func (ContainerState) Number

func (ContainerState) String

func (x ContainerState) String() string

func (ContainerState) Type

type ContainerStatus

type ContainerStatus struct {
	ContainerId   string         `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	ContainerName string         `protobuf:"bytes,2,opt,name=container_name,json=containerName,proto3" json:"container_name,omitempty"`
	State         ContainerState `protobuf:"varint,3,opt,name=state,proto3,enum=ContainerState" json:"state,omitempty"`
	CreatedAt     int64          `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	StartedAt     int64          `protobuf:"varint,5,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
	FinishedAt    int64          `protobuf:"varint,6,opt,name=finished_at,json=finishedAt,proto3" json:"finished_at,omitempty"`
	// Exit code, 仅在 finished_at !=0 时。
	ExitCode int32 `protobuf:"varint,7,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"`
	// 关于当前容器状态的人类可读信息
	Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"`
	// 容器日志文件
	LogPath string `protobuf:"bytes,9,opt,name=log_path,json=logPath,proto3" json:"log_path,omitempty"`
	// contains filtered or unexported fields
}

func (*ContainerStatus) Descriptor deprecated

func (*ContainerStatus) Descriptor() ([]byte, []int)

Deprecated: Use ContainerStatus.ProtoReflect.Descriptor instead.

func (*ContainerStatus) GetContainerId

func (x *ContainerStatus) GetContainerId() string

func (*ContainerStatus) GetContainerName

func (x *ContainerStatus) GetContainerName() string

func (*ContainerStatus) GetCreatedAt

func (x *ContainerStatus) GetCreatedAt() int64

func (*ContainerStatus) GetExitCode

func (x *ContainerStatus) GetExitCode() int32

func (*ContainerStatus) GetFinishedAt

func (x *ContainerStatus) GetFinishedAt() int64

func (*ContainerStatus) GetLogPath

func (x *ContainerStatus) GetLogPath() string

func (*ContainerStatus) GetMessage

func (x *ContainerStatus) GetMessage() string

func (*ContainerStatus) GetStartedAt

func (x *ContainerStatus) GetStartedAt() int64

func (*ContainerStatus) GetState

func (x *ContainerStatus) GetState() ContainerState

func (*ContainerStatus) ProtoMessage

func (*ContainerStatus) ProtoMessage()

func (*ContainerStatus) ProtoReflect

func (x *ContainerStatus) ProtoReflect() protoreflect.Message

func (*ContainerStatus) Reset

func (x *ContainerStatus) Reset()

func (*ContainerStatus) String

func (x *ContainerStatus) String() string

type ContainerStatusRequest

type ContainerStatusRequest struct {
	ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ContainerStatusRequest) Descriptor deprecated

func (*ContainerStatusRequest) Descriptor() ([]byte, []int)

Deprecated: Use ContainerStatusRequest.ProtoReflect.Descriptor instead.

func (*ContainerStatusRequest) GetContainerId

func (x *ContainerStatusRequest) GetContainerId() string

func (*ContainerStatusRequest) ProtoMessage

func (*ContainerStatusRequest) ProtoMessage()

func (*ContainerStatusRequest) ProtoReflect

func (x *ContainerStatusRequest) ProtoReflect() protoreflect.Message

func (*ContainerStatusRequest) Reset

func (x *ContainerStatusRequest) Reset()

func (*ContainerStatusRequest) String

func (x *ContainerStatusRequest) String() string

type ContainerStatusResponse

type ContainerStatusResponse struct {
	Status *ContainerStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*ContainerStatusResponse) Descriptor deprecated

func (*ContainerStatusResponse) Descriptor() ([]byte, []int)

Deprecated: Use ContainerStatusResponse.ProtoReflect.Descriptor instead.

func (*ContainerStatusResponse) GetStatus

func (x *ContainerStatusResponse) GetStatus() *ContainerStatus

func (*ContainerStatusResponse) ProtoMessage

func (*ContainerStatusResponse) ProtoMessage()

func (*ContainerStatusResponse) ProtoReflect

func (x *ContainerStatusResponse) ProtoReflect() protoreflect.Message

func (*ContainerStatusResponse) Reset

func (x *ContainerStatusResponse) Reset()

func (*ContainerStatusResponse) String

func (x *ContainerStatusResponse) String() string

type CreateContainerRequest

type CreateContainerRequest struct {
	Name           string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	RootfsPath     string   `protobuf:"bytes,2,opt,name=rootfs_path,json=rootfsPath,proto3" json:"rootfs_path,omitempty"`
	RootfsReadonly bool     `protobuf:"varint,3,opt,name=rootfs_readonly,json=rootfsReadonly,proto3" json:"rootfs_readonly,omitempty"`
	Command        string   `protobuf:"bytes,4,opt,name=command,proto3" json:"command,omitempty"`
	Args           []string `protobuf:"bytes,5,rep,name=args,proto3" json:"args,omitempty"`
	// 保持容器的 stdin 打开
	Stdin bool `protobuf:"varint,6,opt,name=stdin,proto3" json:"stdin,omitempty"`
	// if true, stdin 将在第一个 attach session 结束后关闭
	StdinOnce bool `protobuf:"varint,7,opt,name=stdin_once,json=stdinOnce,proto3" json:"stdin_once,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateContainerRequest) Descriptor deprecated

func (*CreateContainerRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateContainerRequest.ProtoReflect.Descriptor instead.

func (*CreateContainerRequest) GetArgs

func (x *CreateContainerRequest) GetArgs() []string

func (*CreateContainerRequest) GetCommand

func (x *CreateContainerRequest) GetCommand() string

func (*CreateContainerRequest) GetName

func (x *CreateContainerRequest) GetName() string

func (*CreateContainerRequest) GetRootfsPath

func (x *CreateContainerRequest) GetRootfsPath() string

func (*CreateContainerRequest) GetRootfsReadonly

func (x *CreateContainerRequest) GetRootfsReadonly() bool

func (*CreateContainerRequest) GetStdin

func (x *CreateContainerRequest) GetStdin() bool

func (*CreateContainerRequest) GetStdinOnce

func (x *CreateContainerRequest) GetStdinOnce() bool

func (*CreateContainerRequest) ProtoMessage

func (*CreateContainerRequest) ProtoMessage()

func (*CreateContainerRequest) ProtoReflect

func (x *CreateContainerRequest) ProtoReflect() protoreflect.Message

func (*CreateContainerRequest) Reset

func (x *CreateContainerRequest) Reset()

func (*CreateContainerRequest) String

func (x *CreateContainerRequest) String() string

type CreateContainerResponse

type CreateContainerResponse struct {
	ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateContainerResponse) Descriptor deprecated

func (*CreateContainerResponse) Descriptor() ([]byte, []int)

Deprecated: Use CreateContainerResponse.ProtoReflect.Descriptor instead.

func (*CreateContainerResponse) GetContainerId

func (x *CreateContainerResponse) GetContainerId() string

func (*CreateContainerResponse) ProtoMessage

func (*CreateContainerResponse) ProtoMessage()

func (*CreateContainerResponse) ProtoReflect

func (x *CreateContainerResponse) ProtoReflect() protoreflect.Message

func (*CreateContainerResponse) Reset

func (x *CreateContainerResponse) Reset()

func (*CreateContainerResponse) String

func (x *CreateContainerResponse) String() string

type CriClient

CriClient is the client API for Cri service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewCriClient

func NewCriClient(cc grpc.ClientConnInterface) CriClient

type CriServer

CriServer is the server API for Cri service. All implementations must embed UnimplementedCriServer for forward compatibility

type ListContainersRequest

type ListContainersRequest struct {
	// contains filtered or unexported fields
}

func (*ListContainersRequest) Descriptor deprecated

func (*ListContainersRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListContainersRequest.ProtoReflect.Descriptor instead.

func (*ListContainersRequest) ProtoMessage

func (*ListContainersRequest) ProtoMessage()

func (*ListContainersRequest) ProtoReflect

func (x *ListContainersRequest) ProtoReflect() protoreflect.Message

func (*ListContainersRequest) Reset

func (x *ListContainersRequest) Reset()

func (*ListContainersRequest) String

func (x *ListContainersRequest) String() string

type ListContainersResponse

type ListContainersResponse struct {
	Containers []*Container `protobuf:"bytes,1,rep,name=containers,proto3" json:"containers,omitempty"`
	// contains filtered or unexported fields
}

func (*ListContainersResponse) Descriptor deprecated

func (*ListContainersResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListContainersResponse.ProtoReflect.Descriptor instead.

func (*ListContainersResponse) GetContainers

func (x *ListContainersResponse) GetContainers() []*Container

func (*ListContainersResponse) ProtoMessage

func (*ListContainersResponse) ProtoMessage()

func (*ListContainersResponse) ProtoReflect

func (x *ListContainersResponse) ProtoReflect() protoreflect.Message

func (*ListContainersResponse) Reset

func (x *ListContainersResponse) Reset()

func (*ListContainersResponse) String

func (x *ListContainersResponse) String() string

type RemoveContainerRequest

type RemoveContainerRequest struct {
	ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	// contains filtered or unexported fields
}

func (*RemoveContainerRequest) Descriptor deprecated

func (*RemoveContainerRequest) Descriptor() ([]byte, []int)

Deprecated: Use RemoveContainerRequest.ProtoReflect.Descriptor instead.

func (*RemoveContainerRequest) GetContainerId

func (x *RemoveContainerRequest) GetContainerId() string

func (*RemoveContainerRequest) ProtoMessage

func (*RemoveContainerRequest) ProtoMessage()

func (*RemoveContainerRequest) ProtoReflect

func (x *RemoveContainerRequest) ProtoReflect() protoreflect.Message

func (*RemoveContainerRequest) Reset

func (x *RemoveContainerRequest) Reset()

func (*RemoveContainerRequest) String

func (x *RemoveContainerRequest) String() string

type RemoveContainerResponse

type RemoveContainerResponse struct {
	// contains filtered or unexported fields
}

func (*RemoveContainerResponse) Descriptor deprecated

func (*RemoveContainerResponse) Descriptor() ([]byte, []int)

Deprecated: Use RemoveContainerResponse.ProtoReflect.Descriptor instead.

func (*RemoveContainerResponse) ProtoMessage

func (*RemoveContainerResponse) ProtoMessage()

func (*RemoveContainerResponse) ProtoReflect

func (x *RemoveContainerResponse) ProtoReflect() protoreflect.Message

func (*RemoveContainerResponse) Reset

func (x *RemoveContainerResponse) Reset()

func (*RemoveContainerResponse) String

func (x *RemoveContainerResponse) String() string

type Server

type Server interface {
	CriServer
	Serve(network, addr string) error
}

func New

func New(
	runtimeSrv cri.RuntimeService,
	streamingSrv streaming.Server,
) Server

type StartContainerRequest

type StartContainerRequest struct {
	ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	// contains filtered or unexported fields
}

func (*StartContainerRequest) Descriptor deprecated

func (*StartContainerRequest) Descriptor() ([]byte, []int)

Deprecated: Use StartContainerRequest.ProtoReflect.Descriptor instead.

func (*StartContainerRequest) GetContainerId

func (x *StartContainerRequest) GetContainerId() string

func (*StartContainerRequest) ProtoMessage

func (*StartContainerRequest) ProtoMessage()

func (*StartContainerRequest) ProtoReflect

func (x *StartContainerRequest) ProtoReflect() protoreflect.Message

func (*StartContainerRequest) Reset

func (x *StartContainerRequest) Reset()

func (*StartContainerRequest) String

func (x *StartContainerRequest) String() string

type StartContainerResponse

type StartContainerResponse struct {
	// contains filtered or unexported fields
}

func (*StartContainerResponse) Descriptor deprecated

func (*StartContainerResponse) Descriptor() ([]byte, []int)

Deprecated: Use StartContainerResponse.ProtoReflect.Descriptor instead.

func (*StartContainerResponse) ProtoMessage

func (*StartContainerResponse) ProtoMessage()

func (*StartContainerResponse) ProtoReflect

func (x *StartContainerResponse) ProtoReflect() protoreflect.Message

func (*StartContainerResponse) Reset

func (x *StartContainerResponse) Reset()

func (*StartContainerResponse) String

func (x *StartContainerResponse) String() string

type StopContainerRequest

type StopContainerRequest struct {
	ContainerId string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	// 强杀容器之前的超时秒数
	Timeout int64 `protobuf:"varint,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

func (*StopContainerRequest) Descriptor deprecated

func (*StopContainerRequest) Descriptor() ([]byte, []int)

Deprecated: Use StopContainerRequest.ProtoReflect.Descriptor instead.

func (*StopContainerRequest) GetContainerId

func (x *StopContainerRequest) GetContainerId() string

func (*StopContainerRequest) GetTimeout

func (x *StopContainerRequest) GetTimeout() int64

func (*StopContainerRequest) ProtoMessage

func (*StopContainerRequest) ProtoMessage()

func (*StopContainerRequest) ProtoReflect

func (x *StopContainerRequest) ProtoReflect() protoreflect.Message

func (*StopContainerRequest) Reset

func (x *StopContainerRequest) Reset()

func (*StopContainerRequest) String

func (x *StopContainerRequest) String() string

type StopContainerResponse

type StopContainerResponse struct {
	// contains filtered or unexported fields
}

func (*StopContainerResponse) Descriptor deprecated

func (*StopContainerResponse) Descriptor() ([]byte, []int)

Deprecated: Use StopContainerResponse.ProtoReflect.Descriptor instead.

func (*StopContainerResponse) ProtoMessage

func (*StopContainerResponse) ProtoMessage()

func (*StopContainerResponse) ProtoReflect

func (x *StopContainerResponse) ProtoReflect() protoreflect.Message

func (*StopContainerResponse) Reset

func (x *StopContainerResponse) Reset()

func (*StopContainerResponse) String

func (x *StopContainerResponse) String() string

type UnimplementedCriServer

type UnimplementedCriServer struct {
}

UnimplementedCriServer must be embedded to have forward compatible implementations.

func (UnimplementedCriServer) Attach

func (UnimplementedCriServer) ContainerStatus

func (UnimplementedCriServer) CreateContainer

func (UnimplementedCriServer) ListContainers

func (UnimplementedCriServer) RemoveContainer

func (UnimplementedCriServer) StartContainer

func (UnimplementedCriServer) StopContainer

func (UnimplementedCriServer) Version

type UnsafeCriServer

type UnsafeCriServer interface {
	// contains filtered or unexported methods
}

UnsafeCriServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CriServer will result in compilation errors.

type VersionRequest

type VersionRequest struct {
	// contains filtered or unexported fields
}

func (*VersionRequest) Descriptor deprecated

func (*VersionRequest) Descriptor() ([]byte, []int)

Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead.

func (*VersionRequest) ProtoMessage

func (*VersionRequest) ProtoMessage()

func (*VersionRequest) ProtoReflect

func (x *VersionRequest) ProtoReflect() protoreflect.Message

func (*VersionRequest) Reset

func (x *VersionRequest) Reset()

func (*VersionRequest) String

func (x *VersionRequest) String() string

type VersionResponse

type VersionResponse struct {
	Version        string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	RuntimeName    string `protobuf:"bytes,2,opt,name=runtime_name,json=runtimeName,proto3" json:"runtime_name,omitempty"`
	RuntimeVersion string `protobuf:"bytes,3,opt,name=runtime_version,json=runtimeVersion,proto3" json:"runtime_version,omitempty"`
	// contains filtered or unexported fields
}

func (*VersionResponse) Descriptor deprecated

func (*VersionResponse) Descriptor() ([]byte, []int)

Deprecated: Use VersionResponse.ProtoReflect.Descriptor instead.

func (*VersionResponse) GetRuntimeName

func (x *VersionResponse) GetRuntimeName() string

func (*VersionResponse) GetRuntimeVersion

func (x *VersionResponse) GetRuntimeVersion() string

func (*VersionResponse) GetVersion

func (x *VersionResponse) GetVersion() string

func (*VersionResponse) ProtoMessage

func (*VersionResponse) ProtoMessage()

func (*VersionResponse) ProtoReflect

func (x *VersionResponse) ProtoReflect() protoreflect.Message

func (*VersionResponse) Reset

func (x *VersionResponse) Reset()

func (*VersionResponse) String

func (x *VersionResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL