Documentation
¶
Index ¶
- Constants
- func GetQosFromReq(req *cubebox.RunCubeSandboxRequest, key string) (*disk.RateLimiter, error)
- func RecordCreateMetric(ctx context.Context, err error, id string, cost time.Duration)
- func RecordCreateMetricIfGreaterThan(ctx context.Context, err error, id string, cost time.Duration, ...)
- func RecordDestroyMetric(ctx context.Context, err error, id string, cost time.Duration)
- func WithCreateContext(ctx context.Context, createContext *CreateContext) context.Context
- type BaseWorkflowInfo
- func (m *BaseWorkflowInfo) AddMetric(err error, id string, t time.Duration)
- func (b *BaseWorkflowInfo) GetAppID() int64
- func (b *BaseWorkflowInfo) GetCPU() int64
- func (b *BaseWorkflowInfo) GetInstanceType() string
- func (b *BaseWorkflowInfo) GetMemory() int64
- func (m *BaseWorkflowInfo) GetMetric() []*Metric
- func (b *BaseWorkflowInfo) GetNumaNode() int32
- func (b *BaseWorkflowInfo) GetPCIMode() string
- func (b *BaseWorkflowInfo) GetSandboxID() string
- func (b *BaseWorkflowInfo) GetSubUin() string
- func (b *BaseWorkflowInfo) GetUin() string
- func (b *BaseWorkflowInfo) IsPCIPFMode() bool
- type CleanContext
- type CreateContext
- func (m *CreateContext) AddMetric(err error, id string, t time.Duration)
- func (b *CreateContext) GetInstanceType() string
- func (m *CreateContext) GetMetric() []*Metric
- func (b *CreateContext) GetQos(key string) (*disk.RateLimiter, error)
- func (b *CreateContext) GetRegion() string
- func (b *CreateContext) GetSnapshotTemplateID() (string, bool)
- func (b *CreateContext) IsCreateSnapshot() bool
- func (b *CreateContext) IsCubeboxV2() bool
- func (b *CreateContext) IsPauseResume() bool
- func (b *CreateContext) IsRetoreSnapshot() bool
- type DestroyContext
- type Engine
- func (e *Engine) AddCleaupFlow(f Flow)
- func (e *Engine) AddFlow(k string, f *Workflow)
- func (e *Engine) CleanUp(ctx context.Context, opts *CleanContext) error
- func (e *Engine) Create(ctx context.Context, opts *CreateContext) error
- func (e *Engine) Destroy(ctx context.Context, opts *DestroyContext) error
- func (e *Engine) GetFlowOnFlyingRequests(name string) int64
- func (e *Engine) GetFlowPeakRequests(name string) int64
- func (s *Engine) ID() string
- func (e *Engine) Init(ctx context.Context, opts *InitInfo) error
- func (e *Engine) RegisterMetrics(register *metrictype.CollectRegister) error
- func (e *Engine) SetFlowLimit(name string, limit int64)
- type Flow
- type InitInfo
- type Metric
- type ReqContext
- type Step
- type VolumeRefEvent
- type Workflow
Constants ¶
const ( KCreateContext contextKey = "kCreateContext" KInitContext contextKey = "KInitContext" KDestroyContext contextKey = "KDestroyContext" )
Variables ¶
This section is empty.
Functions ¶
func GetQosFromReq ¶
func GetQosFromReq(req *cubebox.RunCubeSandboxRequest, key string) (*disk.RateLimiter, error)
func RecordCreateMetric ¶
func RecordDestroyMetric ¶
func WithCreateContext ¶
func WithCreateContext(ctx context.Context, createContext *CreateContext) context.Context
Types ¶
type BaseWorkflowInfo ¶
type BaseWorkflowInfo struct {
SandboxID string
CPU int64
Memory int64
PCIMode string
NumaNode int32
IsRollBack bool
AppID int64
Uin string
SubUin string
// contains filtered or unexported fields
}
func (*BaseWorkflowInfo) GetAppID ¶
func (b *BaseWorkflowInfo) GetAppID() int64
func (*BaseWorkflowInfo) GetCPU ¶
func (b *BaseWorkflowInfo) GetCPU() int64
func (*BaseWorkflowInfo) GetInstanceType ¶
func (b *BaseWorkflowInfo) GetInstanceType() string
func (*BaseWorkflowInfo) GetMemory ¶
func (b *BaseWorkflowInfo) GetMemory() int64
func (*BaseWorkflowInfo) GetNumaNode ¶
func (b *BaseWorkflowInfo) GetNumaNode() int32
func (*BaseWorkflowInfo) GetPCIMode ¶
func (b *BaseWorkflowInfo) GetPCIMode() string
func (*BaseWorkflowInfo) GetSandboxID ¶
func (b *BaseWorkflowInfo) GetSandboxID() string
func (*BaseWorkflowInfo) GetSubUin ¶
func (b *BaseWorkflowInfo) GetSubUin() string
func (*BaseWorkflowInfo) GetUin ¶
func (b *BaseWorkflowInfo) GetUin() string
func (*BaseWorkflowInfo) IsPCIPFMode ¶
func (b *BaseWorkflowInfo) IsPCIPFMode() bool
type CreateContext ¶
type CreateContext struct {
BaseWorkflowInfo
ReqInfo *cubebox.RunCubeSandboxRequest
NetworkInfo provider.NetworkProvider
StorageInfo interface{}
CgroupInfo interface{}
VolumeInfo interface{}
Failover bool
UserData *cubeboxstore.UserData
CubeBoxCreated bool
NetFile *netfile.CubeboxNetfile
LocalRunTemplate *templatetypes.LocalRunTemplate
// VolumeRefEvents collects node-level plugin_volume ref-count transitions
// (0→1) observed during this create, to be reported to CubeMaster in the
// create response ext_info on success.
VolumeRefEvents []VolumeRefEvent
}
func GetCreateContext ¶
func GetCreateContext(ctx context.Context) *CreateContext
func (*CreateContext) GetInstanceType ¶
func (b *CreateContext) GetInstanceType() string
func (*CreateContext) GetQos ¶
func (b *CreateContext) GetQos(key string) (*disk.RateLimiter, error)
func (*CreateContext) GetRegion ¶
func (b *CreateContext) GetRegion() string
func (*CreateContext) GetSnapshotTemplateID ¶
func (b *CreateContext) GetSnapshotTemplateID() (string, bool)
func (*CreateContext) IsCreateSnapshot ¶
func (b *CreateContext) IsCreateSnapshot() bool
func (*CreateContext) IsCubeboxV2 ¶
func (b *CreateContext) IsCubeboxV2() bool
func (*CreateContext) IsPauseResume ¶
func (b *CreateContext) IsPauseResume() bool
IsPauseResume is true when Master asks Cubelet to recreate the same sandbox from a pause snapshot (cube.master.pause.snapshot.id). Distinct from create-from-template / create-from-normal-snapshot: guest memory already has container bind mounts, so Cubelet must not re-emit propagation exec.mount / umount annotations.
func (*CreateContext) IsRetoreSnapshot ¶
func (b *CreateContext) IsRetoreSnapshot() bool
type DestroyContext ¶
type DestroyContext struct {
BaseWorkflowInfo
DestroyInfo *cubebox.DestroyCubeSandboxRequest
// VolumeRefEvents collects node-level plugin_volume ref-count transitions
// (1→0) observed during this destroy, to be reported to CubeMaster in the
// destroy response ext_info.
VolumeRefEvents []VolumeRefEvent
}
func (*DestroyContext) GetInstanceType ¶
func (b *DestroyContext) GetInstanceType() string
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AddCleaupFlow ¶
func (*Engine) GetFlowOnFlyingRequests ¶
func (*Engine) GetFlowPeakRequests ¶
func (*Engine) RegisterMetrics ¶
func (e *Engine) RegisterMetrics(register *metrictype.CollectRegister) error
func (*Engine) SetFlowLimit ¶
type InitInfo ¶
type InitInfo struct {
BaseWorkflowInfo
NetCIDR string
MVMInnerIP net.IP
TapInitNum int
}
type ReqContext ¶
type Step ¶
func (*Step) AppendFlow ¶
type VolumeRefEvent ¶
type VolumeRefEvent struct {
VolumeID string `json:"volume_id"`
Referenced int `json:"referenced"`
}
VolumeRefEvent records a node-level plugin_volume reference-state change that must be reported back to CubeMaster so it can maintain a cross-node ref-count in t_cube_volume.
An event is emitted ONLY when this node's reference state for the volume flips: Referenced=1 when the node started referencing it (node-local count 0→1) and Referenced=0 when it stopped (1→0). Repeat references on the same node (count 1→2, 2→1, …) do NOT produce an event.