types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types/bucket.go

Package types/common.go

Package types types/multipart.go - 分片上传相关类型

Package types/object.go

Package types/upload.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketInfo

type BucketInfo struct {
	// 桶名称
	Name string `json:"name"`
	// 创建时间
	CreationDate time.Time `json:"creationDate"`
	// 桶所在区域
	Region string `json:"region,omitempty"`
}

BucketInfo 桶信息

type BucketLookupType

type BucketLookupType int

BucketLookupType 桶查找类型

const (
	// BucketLookupAuto 自动检测
	BucketLookupAuto BucketLookupType = iota
	// BucketLookupDNS DNS 风格
	BucketLookupDNS
	// BucketLookupPath 路径风格
	BucketLookupPath
)

type ChecksumType

type ChecksumType int

ChecksumType 校验和类型

const (
	ChecksumNone ChecksumType = iota
	ChecksumCRC32
	ChecksumCRC32C
	ChecksumSHA1
	ChecksumSHA256
	ChecksumCRC64NVME
)

func (ChecksumType) String

func (c ChecksumType) String() string

String 返回校验和类型字符串

type CompletePart

type CompletePart struct {
	PartNumber        int
	ETag              string
	ChecksumCRC32     string
	ChecksumCRC32C    string
	ChecksumSHA1      string
	ChecksumSHA256    string
	ChecksumCRC64NVME string
}

CompletePart 完成分片信息

type CopyInfo

type CopyInfo struct {
	Bucket            string
	Key               string
	ETag              string
	VersionID         string
	SourceVersionID   string
	LastModified      time.Time
	ChecksumCRC32     string
	ChecksumCRC32C    string
	ChecksumSHA1      string
	ChecksumSHA256    string
	ChecksumCRC64NVME string
}

CopyInfo 复制信息

type DeleteError

type DeleteError struct {
	Key       string
	VersionID string
	Code      string
	Message   string
}

DeleteError 删除错误

type DeletedObject

type DeletedObject struct {
	Key                   string
	VersionID             string
	DeleteMarker          bool
	DeleteMarkerVersionID string
}

DeletedObject 已删除对象结果

type Grant

type Grant struct {
	Grantee    Grantee
	Permission string
}

Grant ACL 授权

type Grantee

type Grantee struct {
	Type        string
	ID          string
	DisplayName string
	URI         string
}

Grantee 授权对象

type LegalHoldStatus

type LegalHoldStatus string

LegalHoldStatus 法律保留状态

const (
	LegalHoldOn  LegalHoldStatus = "ON"
	LegalHoldOff LegalHoldStatus = "OFF"
)

func (LegalHoldStatus) IsValid

func (l LegalHoldStatus) IsValid() bool

IsValid 验证法律保留状态是否有效

type MultipartInfo

type MultipartInfo struct {
	// 上传 ID
	UploadID string `json:"uploadId"`
	// 对象键
	Key string `json:"key"`
	// 发起时间
	Initiated time.Time `json:"initiated"`
	// 发起者
	Initiator struct {
		ID          string
		DisplayName string
	} `json:"initiator,omitempty"`
	// 所有者
	Owner Owner `json:"owner,omitempty"`
	// 存储类
	StorageClass string `json:"storageClass,omitempty"`
	// 大小(聚合)
	Size int64 `json:"size,omitempty"`
	// 错误
	Err error `json:"-"`
}

MultipartInfo 分片上传信息

type ObjectInfo

type ObjectInfo struct {
	// 基本信息
	Key          string    `json:"name"`
	Size         int64     `json:"size"`
	ETag         string    `json:"etag"`
	ContentType  string    `json:"contentType"`
	LastModified time.Time `json:"lastModified"`
	Expires      time.Time `json:"expires,omitempty"`

	// 所有者
	Owner Owner `json:"owner,omitempty"`

	// 存储类
	StorageClass string `json:"storageClass,omitempty"`

	// 版本信息
	VersionID      string `json:"versionId,omitempty"`
	IsLatest       bool   `json:"isLatest,omitempty"`
	IsDeleteMarker bool   `json:"isDeleteMarker,omitempty"`

	// 复制状态
	ReplicationStatus string `json:"replicationStatus,omitempty"`

	// 元数据
	Metadata     http.Header `json:"metadata,omitempty"`
	UserMetadata StringMap   `json:"userMetadata,omitempty"`
	UserTags     URLMap      `json:"userTags,omitempty"`
	UserTagCount int         `json:"userTagCount,omitempty"`

	// 生命周期
	Expiration       time.Time `json:"expiration,omitempty"`
	ExpirationRuleID string    `json:"expirationRuleId,omitempty"`

	// 恢复信息
	Restore *RestoreInfo `json:"restore,omitempty"`

	// 校验和
	ChecksumCRC32     string `json:"checksumCRC32,omitempty"`
	ChecksumCRC32C    string `json:"checksumCRC32C,omitempty"`
	ChecksumSHA1      string `json:"checksumSHA1,omitempty"`
	ChecksumSHA256    string `json:"checksumSHA256,omitempty"`
	ChecksumCRC64NVME string `json:"checksumCRC64NVME,omitempty"`
	ChecksumMode      string `json:"checksumMode,omitempty"`

	// ACL
	Grant []Grant `json:"grant,omitempty"`

	// 版本数量
	NumVersions int `json:"numVersions,omitempty"`

	// 内部信息(EC 编码)
	Internal *struct {
		K int
		M int
	} `json:"internal,omitempty"`

	// 错误(用于列表操作)
	Err error `json:"-"`
}

ObjectInfo 对象元数据信息

type ObjectPart

type ObjectPart struct {
	// PartNumber 分片编号(从 1 开始)
	PartNumber int `xml:"PartNumber"`
	// ETag 分片的 ETag
	ETag string `xml:"ETag"`
	// Size 分片大小
	Size int64 `xml:"Size,omitempty"`
	// LastModified 最后修改时间
	LastModified string `xml:"LastModified,omitempty"`

	// Checksums 校验和
	ChecksumCRC32  string `xml:"ChecksumCRC32,omitempty"`
	ChecksumCRC32C string `xml:"ChecksumCRC32C,omitempty"`
	ChecksumSHA1   string `xml:"ChecksumSHA1,omitempty"`
	ChecksumSHA256 string `xml:"ChecksumSHA256,omitempty"`
}

ObjectPart 对象分片信息(用于分片上传)

type ObjectToDelete

type ObjectToDelete struct {
	Key       string
	VersionID string
}

ObjectToDelete 待删除对象

type Owner

type Owner struct {
	DisplayName string `json:"displayName,omitempty"`
	ID          string `json:"id,omitempty"`
}

Owner 对象所有者信息

type PartInfo

type PartInfo struct {
	// 分片号
	PartNumber int `json:"partNumber"`
	// ETag
	ETag string `json:"etag"`
	// 大小
	Size int64 `json:"size"`
	// 最后修改时间
	LastModified time.Time `json:"lastModified"`

	// 校验和
	ChecksumCRC32     string `json:"checksumCRC32,omitempty"`
	ChecksumCRC32C    string `json:"checksumCRC32C,omitempty"`
	ChecksumSHA1      string `json:"checksumSHA1,omitempty"`
	ChecksumSHA256    string `json:"checksumSHA256,omitempty"`
	ChecksumCRC64NVME string `json:"checksumCRC64NVME,omitempty"`
}

PartInfo 分片信息

type ReplicationStatus

type ReplicationStatus string

ReplicationStatus 复制状态

const (
	ReplicationPending  ReplicationStatus = "PENDING"
	ReplicationComplete ReplicationStatus = "COMPLETED"
	ReplicationFailed   ReplicationStatus = "FAILED"
	ReplicationReplica  ReplicationStatus = "REPLICA"
)

type RestoreInfo

type RestoreInfo struct {
	OngoingRestore bool
	ExpiryTime     time.Time
}

RestoreInfo 归档恢复信息

type RetentionMode

type RetentionMode string

RetentionMode 保留模式

const (
	RetentionGovernance RetentionMode = "GOVERNANCE"
	RetentionCompliance RetentionMode = "COMPLIANCE"
)

func (RetentionMode) IsValid

func (r RetentionMode) IsValid() bool

IsValid 验证保留模式是否有效

type StringMap

type StringMap map[string]string

StringMap 自定义字符串映射(用于 XML 解析)

type URLMap

type URLMap map[string]string

URLMap URL 编码的映射

type UploadInfo

type UploadInfo struct {
	// 桶名称
	Bucket string `json:"bucket"`
	// 对象键
	Key string `json:"key"`
	// ETag
	ETag string `json:"etag"`
	// 大小
	Size int64 `json:"size"`
	// 最后修改时间
	LastModified time.Time `json:"lastModified"`
	// 位置
	Location string `json:"location,omitempty"`
	// 版本 ID
	VersionID string `json:"versionId,omitempty"`

	// 生命周期过期信息
	Expiration       time.Time `json:"expiration,omitempty"`
	ExpirationRuleID string    `json:"expirationRuleId,omitempty"`

	// 校验和
	ChecksumCRC32     string `json:"checksumCRC32,omitempty"`
	ChecksumCRC32C    string `json:"checksumCRC32C,omitempty"`
	ChecksumSHA1      string `json:"checksumSHA1,omitempty"`
	ChecksumSHA256    string `json:"checksumSHA256,omitempty"`
	ChecksumCRC64NVME string `json:"checksumCRC64NVME,omitempty"`
	ChecksumMode      string `json:"checksumMode,omitempty"`
}

UploadInfo 上传结果信息

type VersioningConfig

type VersioningConfig struct {
	Status    string // Enabled, Suspended
	MFADelete string // Enabled, Disabled
}

VersioningConfig 版本控制配置

func (VersioningConfig) IsEnabled

func (v VersioningConfig) IsEnabled() bool

IsEnabled 检查版本控制是否启用

func (VersioningConfig) IsSuspended

func (v VersioningConfig) IsSuspended() bool

IsSuspended 检查版本控制是否暂停

Jump to

Keyboard shortcuts

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