rpc

package
v0.0.0-...-ff909ee Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WatchServiceStatus .
	WatchServiceStatus codes.Code = 1001

	// ListNetworks .
	ListNetworks codes.Code = 1011
	// ConnectNetwork .
	ConnectNetwork codes.Code = 1012
	// DisconnectNetwork .
	DisconnectNetwork codes.Code = 1013

	// AddPod .
	AddPod codes.Code = 1021
	// RemovePod .
	RemovePod codes.Code = 1022
	// GetPod .
	GetPod codes.Code = 1023
	// ListPods .
	ListPods codes.Code = 1024
	// PodResource .
	PodResource codes.Code = 1025

	// AddNode .
	AddNode codes.Code = 1031
	// RemoveNode .
	RemoveNode codes.Code = 1032
	// ListPodNodes .
	ListPodNodes codes.Code = 1033
	// GetNode .
	GetNode codes.Code = 1034
	// SetNode .
	SetNode codes.Code = 1035
	// SetNodeStatus .
	SetNodeStatus codes.Code = 1036
	// GetNodeStatus .
	GetNodeStatus codes.Code = 1038
	// GetNodeResource .
	GetNodeResource codes.Code = 1037
	// GetNodeEngine .
	GetNodeEngine codes.Code = 1038

	// CalculateCapacity .
	CalculateCapacity codes.Code = 1041

	// GetWorkload .
	GetWorkload codes.Code = 1051
	// GetWorkloads .
	GetWorkloads codes.Code = 1052
	// ListWorkloads .
	ListWorkloads codes.Code = 1053
	// ListNodeWorkloads .
	ListNodeWorkloads codes.Code = 1054
	// GetWorkloadsStatus .
	GetWorkloadsStatus codes.Code = 1055
	// SetWorkloadsStatus .
	SetWorkloadsStatus codes.Code = 1056
	// RawEngine
	RawEngineStatus codes.Code = 1057

	// Copy .
	Copy codes.Code = 1061
	// Send .
	Send codes.Code = 1062
	// SendLargeFile .
	SendLargeFile codes.Code = 1063

	// BuildImage .
	BuildImage codes.Code = 1071
	// CacheImage .
	CacheImage codes.Code = 1072
	// RemoveImage .
	RemoveImage codes.Code = 1073

	// CreateWorkload .
	CreateWorkload codes.Code = 1074
	// ReplaceWorkload .
	ReplaceWorkload codes.Code = 1075
	// RemoveWorkload .
	RemoveWorkload codes.Code = 1076
	// DissociateWorkload .
	DissociateWorkload codes.Code = 1077
	// ControlWorkload .
	ControlWorkload codes.Code = 1078
	// ExecuteWorkload .
	ExecuteWorkload codes.Code = 1079
	// ReallocResource .
	ReallocResource codes.Code = 10710
	// LogStream .
	LogStream codes.Code = 10711
	// RunAndWait .
	RunAndWait codes.Code = 10712
	// ListImage .
	ListImage codes.Code = 10713
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Vibranium

type Vibranium struct {
	TaskNum int
	// contains filtered or unexported fields
}

Vibranium is implementations for grpc server interface Many data types should be transformed

func New

func New(cluster cluster.Cluster, config types.Config, stop chan struct{}) *Vibranium

New will new a new cluster instance

func (*Vibranium) AddNode

func (v *Vibranium) AddNode(ctx context.Context, opts *pb.AddNodeOptions) (*pb.Node, error)

AddNode saves a node and returns it to client Method must be called synchronously, or nothing will be returned

func (*Vibranium) AddPod

func (v *Vibranium) AddPod(ctx context.Context, opts *pb.AddPodOptions) (*pb.Pod, error)

AddPod saves a pod, and returns it to client

func (*Vibranium) BuildImage

func (v *Vibranium) BuildImage(opts *pb.BuildImageOptions, stream pb.CoreRPC_BuildImageServer) error

BuildImage streamed returned functions

func (*Vibranium) CacheImage

func (v *Vibranium) CacheImage(opts *pb.CacheImageOptions, stream pb.CoreRPC_CacheImageServer) error

CacheImage cache image

func (*Vibranium) CalculateCapacity

func (v *Vibranium) CalculateCapacity(ctx context.Context, opts *pb.DeployOptions) (*pb.CapacityMessage, error)

CalculateCapacity calculates capacity for each node

func (*Vibranium) ConnectNetwork

func (v *Vibranium) ConnectNetwork(ctx context.Context, opts *pb.ConnectNetworkOptions) (*pb.Network, error)

ConnectNetwork connect network

func (*Vibranium) ControlWorkload

func (v *Vibranium) ControlWorkload(opts *pb.ControlWorkloadOptions, stream pb.CoreRPC_ControlWorkloadServer) error

ControlWorkload control workloads

func (*Vibranium) Copy

func (v *Vibranium) Copy(opts *pb.CopyOptions, stream pb.CoreRPC_CopyServer) error

Copy copy files from multiple workloads

func (*Vibranium) CreateWorkload

func (v *Vibranium) CreateWorkload(opts *pb.DeployOptions, stream pb.CoreRPC_CreateWorkloadServer) error

CreateWorkload create workloads

func (*Vibranium) DisconnectNetwork

func (v *Vibranium) DisconnectNetwork(ctx context.Context, opts *pb.DisconnectNetworkOptions) (*pb.Empty, error)

DisconnectNetwork disconnect network

func (*Vibranium) DissociateWorkload

func (v *Vibranium) DissociateWorkload(opts *pb.DissociateWorkloadOptions, stream pb.CoreRPC_DissociateWorkloadServer) error

DissociateWorkload dissociate workload

func (*Vibranium) ExecuteWorkload

func (v *Vibranium) ExecuteWorkload(stream pb.CoreRPC_ExecuteWorkloadServer) error

ExecuteWorkload runs a command in a running workload

func (*Vibranium) GetNode

func (v *Vibranium) GetNode(ctx context.Context, opts *pb.GetNodeOptions) (*pb.Node, error)

GetNode get a node

func (*Vibranium) GetNodeEngineInfo

func (v *Vibranium) GetNodeEngineInfo(ctx context.Context, opts *pb.GetNodeOptions) (*pb.Engine, error)

GetNodeEngine get a node engine

func (*Vibranium) GetNodeResource

func (v *Vibranium) GetNodeResource(ctx context.Context, opts *pb.GetNodeResourceOptions) (*pb.NodeResource, error)

GetNodeResource check node resource

func (*Vibranium) GetNodeStatus

GetNodeStatus set status of a node for reporting

func (*Vibranium) GetPod

func (v *Vibranium) GetPod(ctx context.Context, opts *pb.GetPodOptions) (*pb.Pod, error)

GetPod show a pod

func (*Vibranium) GetPodResource

func (v *Vibranium) GetPodResource(opts *pb.GetPodOptions, stream pb.CoreRPC_GetPodResourceServer) error

GetPodResource get pod nodes resource usage

func (*Vibranium) GetWorkload

func (v *Vibranium) GetWorkload(ctx context.Context, ID *pb.WorkloadID) (*pb.Workload, error)

GetWorkload get a workload More information will be shown

func (*Vibranium) GetWorkloads

func (v *Vibranium) GetWorkloads(ctx context.Context, cids *pb.WorkloadIDs) (*pb.Workloads, error)

GetWorkloads get lots workloads like GetWorkload, information should be returned

func (*Vibranium) GetWorkloadsStatus

func (v *Vibranium) GetWorkloadsStatus(ctx context.Context, opts *pb.WorkloadIDs) (*pb.WorkloadsStatus, error)

GetWorkloadsStatus get workloads status

func (*Vibranium) Info

func (v *Vibranium) Info(context.Context, *pb.Empty) (*pb.CoreInfo, error)

Info show core info

func (*Vibranium) ListImage

func (v *Vibranium) ListImage(opts *pb.ListImageOptions, stream pb.CoreRPC_ListImageServer) error

ListImage list image

func (*Vibranium) ListNetworks

func (v *Vibranium) ListNetworks(ctx context.Context, opts *pb.ListNetworkOptions) (*pb.Networks, error)

ListNetworks list networks for pod

func (*Vibranium) ListNodeWorkloads

func (v *Vibranium) ListNodeWorkloads(ctx context.Context, opts *pb.GetNodeOptions) (*pb.Workloads, error)

ListNodeWorkloads list node workloads

func (*Vibranium) ListPodNodes

func (v *Vibranium) ListPodNodes(opts *pb.ListNodesOptions, stream pb.CoreRPC_ListPodNodesServer) error

ListPodNodes returns a list of node for pod

func (*Vibranium) ListPods

func (v *Vibranium) ListPods(ctx context.Context, _ *pb.Empty) (*pb.Pods, error)

ListPods returns a list of pods

func (*Vibranium) ListWorkloads

func (v *Vibranium) ListWorkloads(opts *pb.ListWorkloadsOptions, stream pb.CoreRPC_ListWorkloadsServer) error

ListWorkloads by appname with optional entrypoint and nodename

func (*Vibranium) LogStream

func (v *Vibranium) LogStream(opts *pb.LogStreamOptions, stream pb.CoreRPC_LogStreamServer) error

LogStream get workload logs

func (*Vibranium) NodeStatusStream

func (v *Vibranium) NodeStatusStream(_ *pb.Empty, stream pb.CoreRPC_NodeStatusStreamServer) error

NodeStatusStream watch and show deployed status

func (*Vibranium) RawEngine

func (v *Vibranium) RawEngine(ctx context.Context, opts *pb.RawEngineOptions) (*pb.RawEngineMessage, error)

func (*Vibranium) ReallocResource

func (v *Vibranium) ReallocResource(ctx context.Context, opts *pb.ReallocOptions) (msg *pb.ReallocResourceMessage, err error)

ReallocResource realloc res for workloads

func (*Vibranium) RemoveImage

func (v *Vibranium) RemoveImage(opts *pb.RemoveImageOptions, stream pb.CoreRPC_RemoveImageServer) error

RemoveImage remove image

func (*Vibranium) RemoveNode

func (v *Vibranium) RemoveNode(ctx context.Context, opts *pb.RemoveNodeOptions) (*pb.Empty, error)

RemoveNode removes the node from etcd

func (*Vibranium) RemovePod

func (v *Vibranium) RemovePod(ctx context.Context, opts *pb.RemovePodOptions) (*pb.Empty, error)

RemovePod removes a pod only if it's empty

func (*Vibranium) RemoveWorkload

func (v *Vibranium) RemoveWorkload(opts *pb.RemoveWorkloadOptions, stream pb.CoreRPC_RemoveWorkloadServer) error

RemoveWorkload remove workloads

func (*Vibranium) ReplaceWorkload

func (v *Vibranium) ReplaceWorkload(opts *pb.ReplaceOptions, stream pb.CoreRPC_ReplaceWorkloadServer) error

ReplaceWorkload replace workloads

func (*Vibranium) RunAndWait

func (v *Vibranium) RunAndWait(stream pb.CoreRPC_RunAndWaitServer) error

RunAndWait is lambda

func (*Vibranium) Send

func (v *Vibranium) Send(opts *pb.SendOptions, stream pb.CoreRPC_SendServer) error

Send send files to some contaienrs

func (*Vibranium) SendLargeFile

func (v *Vibranium) SendLargeFile(stream pb.CoreRPC_SendLargeFileServer) error

func (*Vibranium) SetNode

func (v *Vibranium) SetNode(ctx context.Context, opts *pb.SetNodeOptions) (*pb.Node, error)

SetNode set node meta

func (*Vibranium) SetNodeStatus

func (v *Vibranium) SetNodeStatus(ctx context.Context, opts *pb.SetNodeStatusOptions) (*pb.Empty, error)

SetNodeStatus set status of a node for reporting

func (*Vibranium) SetWorkloadsStatus

func (v *Vibranium) SetWorkloadsStatus(ctx context.Context, opts *pb.SetWorkloadsStatusOptions) (*pb.WorkloadsStatus, error)

SetWorkloadsStatus set workloads status

func (*Vibranium) Wait

func (v *Vibranium) Wait()

Wait for all tasks done 会在外面graceful之后调用. 不完成不给退出进程.

func (*Vibranium) WatchServiceStatus

func (v *Vibranium) WatchServiceStatus(_ *pb.Empty, stream pb.CoreRPC_WatchServiceStatusServer) (err error)

WatchServiceStatus pushes sibling services

func (*Vibranium) WorkloadStatusStream

func (v *Vibranium) WorkloadStatusStream(opts *pb.WorkloadStatusStreamOptions, stream pb.CoreRPC_WorkloadStatusStreamServer) error

WorkloadStatusStream watch and show deployed status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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