droboticflow/internal/domain/object_storage_browser.go
eust-w 0c163203ed 🛠️ fix: large-object-safe BOS moves with progress, prechecks, and capture-conflict guard
- MovePrefix/RenameObject now copy objects larger than the 5 GB BOS
  simple-copy limit via multipart part copy (preserving Content-Type and
  user metadata), with per-object rollback that only removes
  destinations created by the move itself
- MovePrefix reports per-object progress for async tracking
- directory moves and deletes guard against capture-automation watched
  prefixes with an explicit force confirmation (409
  capture_automation_conflict)
- move precheck rejects no-op destinations and parent/child overlapping
  selections with actionable error codes instead of a bare validation
  failure
- new POST/GET /api/object-storage/move-jobs async move jobs with
  progress polling so large directory moves survive HTTP timeouts
- frontend object browser surfaces validation issue details, uses the
  async move job for directory moves, and asks for force confirmation
  when a capture automation watches the affected prefix
2026-09-04 15:34:55 +08:00

171 lines
6.6 KiB
Go

package domain
type ObjectStorageBucketSummary struct {
Name string `json:"name"`
ObjectCount int64 `json:"objectCount,omitempty"`
TotalBytes int64 `json:"totalBytes,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
LastModified string `json:"lastModified,omitempty"`
}
type ObjectStorageObjectSummary struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
Name string `json:"name"`
Kind string `json:"kind"`
SizeBytes int64 `json:"sizeBytes,omitempty"`
ContentType string `json:"contentType,omitempty"`
ETag string `json:"etag,omitempty"`
VersionID string `json:"versionId,omitempty"`
LastModified string `json:"lastModified,omitempty"`
StorageClass string `json:"storageClass,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type ObjectStorageOverview struct {
ConnectionID string `json:"connectionId,omitempty"`
ConnectionName string `json:"connectionName,omitempty"`
Provider string `json:"provider"`
Endpoint string `json:"endpoint,omitempty"`
Bucket string `json:"bucket,omitempty"`
Configured bool `json:"configured"`
Buckets []ObjectStorageBucketSummary `json:"buckets"`
}
type ObjectStorageBrowseResult struct {
ConnectionID string `json:"connectionId,omitempty"`
ConnectionName string `json:"connectionName,omitempty"`
Provider string `json:"provider"`
Endpoint string `json:"endpoint,omitempty"`
Configured bool `json:"configured"`
Bucket string `json:"bucket"`
Prefix string `json:"prefix,omitempty"`
Items []ObjectStorageObjectSummary `json:"items"`
NextMarker string `json:"nextMarker,omitempty"`
HasMore bool `json:"hasMore"`
Limit int `json:"limit,omitempty"`
}
type ObjectStorageBucketCreateInput struct {
Name string `json:"name"`
}
type ObjectStorageBucketMutationResult struct {
Bucket ObjectStorageBucketSummary `json:"bucket"`
}
type ObjectStorageBucketDeleteResult struct {
Bucket string `json:"bucket"`
Deleted bool `json:"deleted"`
}
type ObjectStorageObjectPutInput struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
Content string `json:"content"`
ContentType string `json:"contentType,omitempty"`
}
type ObjectStorageObjectRenameInput struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
NewKey string `json:"newKey"`
Recursive bool `json:"recursive,omitempty"`
DestinationPrefix string `json:"destinationPrefix,omitempty"`
Items []ObjectStorageObjectMoveItem `json:"items,omitempty"`
Force bool `json:"force,omitempty"`
}
type ObjectStorageObjectMoveItem struct {
Key string `json:"key"`
Kind string `json:"kind,omitempty"`
Recursive bool `json:"recursive,omitempty"`
}
type ObjectStorageObjectMutationResult struct {
Object ObjectStorageObjectSummary `json:"object"`
Objects []ObjectStorageObjectSummary `json:"objects,omitempty"`
}
type ObjectStorageObjectDeleteResult struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
Deleted bool `json:"deleted"`
}
type ObjectStoragePresignedUploadResult struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
Method string `json:"method"`
URL string `json:"url"`
Headers map[string]string `json:"headers,omitempty"`
ExpiresAt string `json:"expiresAt"`
}
type ObjectStorageMultipartUploadCreateResult struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
UploadID string `json:"uploadId"`
ExpiresAt string `json:"expiresAt"`
}
type ObjectStorageMultipartUploadPartURLResult struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
UploadID string `json:"uploadId"`
PartNumber int `json:"partNumber"`
Method string `json:"method"`
URL string `json:"url"`
Headers map[string]string `json:"headers,omitempty"`
ExpiresAt string `json:"expiresAt"`
}
type ObjectStorageMultipartUploadPart struct {
PartNumber int `json:"partNumber"`
ETag string `json:"eTag"`
SizeBytes int64 `json:"sizeBytes,omitempty" bson:"sizeBytes,omitempty"`
}
type ObjectStorageMultipartUploadAbortResult struct {
Bucket string `json:"bucket"`
Key string `json:"key"`
UploadID string `json:"uploadId"`
Aborted bool `json:"aborted"`
}
type ObjectStorageBatchUploadItemInput struct {
RelativePath string `json:"relativePath"`
Kind string `json:"kind"`
SizeBytes int64 `json:"sizeBytes,omitempty"`
ContentType string `json:"contentType,omitempty"`
}
type ObjectStorageBatchUploadPrepareInput struct {
Bucket string `json:"bucket"`
Prefix string `json:"prefix,omitempty"`
ConflictPolicy string `json:"conflictPolicy,omitempty"`
Items []ObjectStorageBatchUploadItemInput `json:"items"`
}
type ObjectStorageBatchUploadPreparedItem struct {
RelativePath string `json:"relativePath"`
Key string `json:"key"`
Kind string `json:"kind"`
SizeBytes int64 `json:"sizeBytes,omitempty"`
ContentType string `json:"contentType,omitempty"`
Action string `json:"action"`
Exists bool `json:"exists"`
Message string `json:"message,omitempty"`
}
type ObjectStorageBatchUploadPrepareResult struct {
Bucket string `json:"bucket"`
Prefix string `json:"prefix,omitempty"`
ConflictPolicy string `json:"conflictPolicy"`
Items []ObjectStorageBatchUploadPreparedItem `json:"items"`
UploadCount int `json:"uploadCount"`
PlaceholderCount int `json:"placeholderCount"`
SkipCount int `json:"skipCount"`
ConflictCount int `json:"conflictCount"`
}