disk

package
v0.0.0-...-7aae7b9 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 14 Imported by: 0

README

存储卷管理

统一状态

各云商状态

阿里云: 云盘状态表

  • Creating 创建中。 通过RunInstances、CreateInstance或CreateDisk创建了云盘后,云盘进入短暂的创建中状态。
  • Available 待挂载。 通过CreateDisk成功创建一块按量付费云盘或通过DetachDisk卸载一块按量付费数据盘后,云盘进入稳定的待挂载状态。
  • In_Use 使用中。 云盘的稳定状态,
  • ReIniting 初始化中。通过ReInitDisk重新初始化一块系统盘或者数据盘后,云盘进入短暂的初始化中状态。
  • Detaching 卸载中。 通过DetachDisk卸载一块按量付费数据盘后,云盘进入短暂的卸载中状态。
  • Deleting* 删除中。 通过DeleteDisk释放一块按量付费数据盘后,云盘进入短暂的删除中状态。
  • Deleted* 已删除。 通过DeleteDisk释放一块按量付费数据盘后,云盘进入短暂的已删除状态。

腾讯云: Disk数据结构 云盘状态。取值范围:

  • UNATTACHED:未挂载
  • ATTACHING:挂载中
  • ATTACHED:已挂载
  • DETACHING:解挂中
  • EXPANDING:扩容中
  • ROLLBACKING:回滚中
  • TORECYCLE:待回收
  • DUMPING:拷贝硬盘中

华为云: 云硬盘状态

  • creating 云硬盘处于正在创建的过程中。
  • available 云硬盘创建成功,还未挂载给任何云服务器,可以进行挂载。
  • in-use 云硬盘已挂载给云服务器,正在使用中。
  • error 云硬盘在创建过程中出现错误。
  • attaching 云硬盘处于正在挂载的过程中。
  • detaching 云硬盘处于正在卸载的过程中。
  • restoring-backup 云硬盘处于正在从备份恢复的过程中。
  • backing-up 云硬盘处于通过备份创建的过程中。
  • error_restoring 云硬盘从备份恢复过程中出现错误。
  • uploading 云硬盘数据正在被上传到镜像中。此状态出现在从云服务器创建镜像的操作过程中。
  • downloading 正在从镜像下载数据到云硬盘。此状态出现在创建云服务器的操作过程中。
  • extending 云硬盘处于正在扩容的过程中。
  • error_extending 云硬盘在扩容过程中出现错误。
  • deleting 云硬盘处于正在删除的过程中。
  • error_deleting云硬盘在删除过程中出现错误。
  • rollbacking 云硬盘处于正在从快照回滚数据的过程中。
  • error_rollbacking 云硬盘在从快照回滚数据的过程中出现错误。
  • awaiting-transfer 云硬盘处于等待过户的过程中。
统一后状态

以腾讯云状态作为统一:

  • UNATTACHED:未挂载
  • ATTACHING:挂载中
  • ATTACHED:已挂载
  • DETACHING:解挂中
  • EXPANDING:扩容中
  • ROLLBACKING:回滚中
  • TORECYCLE:待回收
  • DUMPING:拷贝硬盘中

Documentation

Index

Constants

View Source
const (
	AppName = "disk"
)

Variables

View Source
var (
	STATUS_name = map[int32]string{
		0:  "UNKNOW",
		5:  "PENDING",
		6:  "ATTACHING",
		7:  "UNATTACHED",
		11: "ATTACHED",
		30: "DETACHING",
		31: "ROLLBACKING",
		32: "EXPANDING",
		34: "DUMPING",
		80: "RECYCLE",
		90: "DESTROYED",
	}
	STATUS_value = map[string]int32{
		"UNKNOW":      0,
		"PENDING":     5,
		"ATTACHING":   6,
		"UNATTACHED":  7,
		"ATTACHED":    11,
		"DETACHING":   30,
		"ROLLBACKING": 31,
		"EXPANDING":   32,
		"DUMPING":     34,
		"RECYCLE":     80,
		"DESTROYED":   90,
	}
)

Enum value maps for STATUS.

View Source
var File_apps_disk_pb_disk_proto protoreflect.FileDescriptor
View Source
var File_apps_disk_pb_rpc_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "infraboard.cmdb.disk.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SyncDisk",
			Handler:    _Service_SyncDisk_Handler,
		},
		{
			MethodName: "QueryDisk",
			Handler:    _Service_QueryDisk_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/disk/pb/rpc.proto",
}

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

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Describe

type Describe struct {

	// 类型 (系统盘, 数据盘) 阿里: system:系统盘; data:数据盘
	// @gotags: json:"type"
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type"`
	// 关联的实例
	// @gotags: json:"instance_id"
	InstanceId string `protobuf:"bytes,2,opt,name=instance_id,json=instanceId,proto3" json:"instance_id"`
	// 容量大小
	// @gotags: json:"size"
	Size uint64 `protobuf:"varint,3,opt,name=size,proto3" json:"size"`
	// IOPS
	// @gotags: json:"iops"
	Iops int32 `protobuf:"varint,11,opt,name=iops,proto3" json:"iops"`
	// 卸载时间
	// @gotags: json:"detached_time"
	DetachedTime int64 `protobuf:"varint,4,opt,name=detached_time,json=detachedTime,proto3" json:"detached_time"`
	// 挂载时间
	// @gotags: json:"attached_time"
	AttachedTime int64 `protobuf:"varint,5,opt,name=attached_time,json=attachedTime,proto3" json:"attached_time"`
	// 是否为弹性云盘
	// @gotags: json:"portable"
	Portable bool `protobuf:"varint,6,opt,name=portable,proto3" json:"portable"`
	// 比如: /dev/xvdc
	// @gotags: json:"device"
	Device string `protobuf:"bytes,7,opt,name=device,proto3" json:"device"`
	// 是否加密
	// @gotags: json:"encrypted"
	Encrypted bool `protobuf:"varint,8,opt,name=encrypted,proto3" json:"encrypted"`
	// 自动快照
	// @gotags: json:"enable_auto_snapshot"
	EnableAutoSnapshot bool `protobuf:"varint,9,opt,name=enable_auto_snapshot,json=enableAutoSnapshot,proto3" json:"enable_auto_snapshot"`
	// 随实例销毁
	// @gotags: json:"delete_with_instance"
	DeleteWithInstance bool `protobuf:"varint,10,opt,name=delete_with_instance,json=deleteWithInstance,proto3" json:"delete_with_instance"`
	// 是否是共享盘
	// @gotags: json:"multi_attach"
	MultiAttach bool `protobuf:"varint,12,opt,name=multi_attach,json=multiAttach,proto3" json:"multi_attach"`
	// contains filtered or unexported fields
}

func (*Describe) Descriptor deprecated

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

Deprecated: Use Describe.ProtoReflect.Descriptor instead.

func (*Describe) GetAttachedTime

func (x *Describe) GetAttachedTime() int64

func (*Describe) GetDeleteWithInstance

func (x *Describe) GetDeleteWithInstance() bool

func (*Describe) GetDetachedTime

func (x *Describe) GetDetachedTime() int64

func (*Describe) GetDevice

func (x *Describe) GetDevice() string

func (*Describe) GetEnableAutoSnapshot

func (x *Describe) GetEnableAutoSnapshot() bool

func (*Describe) GetEncrypted

func (x *Describe) GetEncrypted() bool

func (*Describe) GetInstanceId

func (x *Describe) GetInstanceId() string

func (*Describe) GetIops

func (x *Describe) GetIops() int32

func (*Describe) GetMultiAttach

func (x *Describe) GetMultiAttach() bool

func (*Describe) GetPortable

func (x *Describe) GetPortable() bool

func (*Describe) GetSize

func (x *Describe) GetSize() uint64

func (*Describe) GetType

func (x *Describe) GetType() string

func (*Describe) ProtoMessage

func (*Describe) ProtoMessage()

func (*Describe) ProtoReflect

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

func (*Describe) Reset

func (x *Describe) Reset()

func (*Describe) String

func (x *Describe) String() string

type Disk

type Disk struct {

	// @gotags: json:"resource"
	Resource *resource.Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource"`
	// @gotags: json:"describe"
	Describe *Describe `protobuf:"bytes,2,opt,name=describe,proto3" json:"describe"`
	// contains filtered or unexported fields
}

func NewDefaultDisk

func NewDefaultDisk() *Disk

func (*Disk) Descriptor deprecated

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

Deprecated: Use Disk.ProtoReflect.Descriptor instead.

func (*Disk) GetDescribe

func (x *Disk) GetDescribe() *Describe

func (*Disk) GetResource

func (x *Disk) GetResource() *resource.Resource

func (*Disk) ProtoMessage

func (*Disk) ProtoMessage()

func (*Disk) ProtoReflect

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

func (*Disk) Reset

func (x *Disk) Reset()

func (*Disk) String

func (x *Disk) String() string

type DiskSet

type DiskSet struct {

	// 总数量
	// @gotags: json:"total"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"`
	// 列表项
	// @gotags: json:"items"
	Items []*Disk `protobuf:"bytes,2,rep,name=items,proto3" json:"items"`
	// contains filtered or unexported fields
}

func NewDiskSet

func NewDiskSet() *DiskSet

func (*DiskSet) Add

func (s *DiskSet) Add(items ...any)

func (*DiskSet) Descriptor deprecated

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

Deprecated: Use DiskSet.ProtoReflect.Descriptor instead.

func (*DiskSet) GetItems

func (x *DiskSet) GetItems() []*Disk

func (*DiskSet) GetTotal

func (x *DiskSet) GetTotal() int64

func (*DiskSet) Length

func (s *DiskSet) Length() int64

func (*DiskSet) ProtoMessage

func (*DiskSet) ProtoMessage()

func (*DiskSet) ProtoReflect

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

func (*DiskSet) Reset

func (x *DiskSet) Reset()

func (*DiskSet) ResourceIds

func (s *DiskSet) ResourceIds() (ids []string)

func (*DiskSet) String

func (x *DiskSet) String() string

func (*DiskSet) ToAny

func (s *DiskSet) ToAny() (items []any)

func (*DiskSet) ToJsonString

func (s *DiskSet) ToJsonString() string

type QueryDiskRequest

type QueryDiskRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// contains filtered or unexported fields
}

func (*QueryDiskRequest) Descriptor deprecated

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

Deprecated: Use QueryDiskRequest.ProtoReflect.Descriptor instead.

func (*QueryDiskRequest) GetPage

func (x *QueryDiskRequest) GetPage() *request.PageRequest

func (*QueryDiskRequest) ProtoMessage

func (*QueryDiskRequest) ProtoMessage()

func (*QueryDiskRequest) ProtoReflect

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

func (*QueryDiskRequest) Reset

func (x *QueryDiskRequest) Reset()

func (*QueryDiskRequest) String

func (x *QueryDiskRequest) String() string

type STATUS

type STATUS int32
const (
	// 未知状态
	STATUS_UNKNOW STATUS = 0
	// 表示创建中
	STATUS_PENDING STATUS = 5
	// 挂载中
	STATUS_ATTACHING STATUS = 6
	// 未挂载
	STATUS_UNATTACHED STATUS = 7
	// 已挂载
	STATUS_ATTACHED STATUS = 11
	// 解挂中
	STATUS_DETACHING STATUS = 30
	// 回滚中
	STATUS_ROLLBACKING STATUS = 31
	// 扩容中
	STATUS_EXPANDING STATUS = 32
	// 实例克隆中
	STATUS_DUMPING STATUS = 34
	// 表示停止待销毁
	STATUS_RECYCLE STATUS = 80
	// 已销毁
	STATUS_DESTROYED STATUS = 90
)

func ParseSTATUSFromString

func ParseSTATUSFromString(str string) (STATUS, error)

ParseSTATUSFromString Parse STATUS from string

func (STATUS) Descriptor

func (STATUS) Descriptor() protoreflect.EnumDescriptor

func (STATUS) Enum

func (x STATUS) Enum() *STATUS

func (STATUS) EnumDescriptor deprecated

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

Deprecated: Use STATUS.Descriptor instead.

func (STATUS) Equal

func (t STATUS) Equal(target STATUS) bool

Equal type compare

func (STATUS) IsIn

func (t STATUS) IsIn(targets ...STATUS) bool

IsIn todo

func (STATUS) MarshalJSON

func (t STATUS) MarshalJSON() ([]byte, error)

MarshalJSON todo

func (STATUS) Number

func (x STATUS) Number() protoreflect.EnumNumber

func (STATUS) String

func (x STATUS) String() string

func (STATUS) Type

func (STATUS) Type() protoreflect.EnumType

func (*STATUS) UnmarshalJSON

func (t *STATUS) UnmarshalJSON(b []byte) error

UnmarshalJSON todo

type ServiceClient

type ServiceClient interface {
	SyncDisk(ctx context.Context, in *Disk, opts ...grpc.CallOption) (*Disk, error)
	QueryDisk(ctx context.Context, in *QueryDiskRequest, opts ...grpc.CallOption) (*DiskSet, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	SyncDisk(context.Context, *Disk) (*Disk, error)
	QueryDisk(context.Context, *QueryDiskRequest) (*DiskSet, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) QueryDisk

func (UnimplementedServiceServer) SyncDisk

type UnsafeServiceServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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