Documentation
¶
Index ¶
- func IsNotFound(err error) bool
- func IsNotModified(err error) bool
- func IsPreconditionFailed(err error) bool
- type ByteRange
- type CRRHook
- type ConditionalResult
- type Config
- type CopyObjectRequest
- type CopyObjectResult
- type DeleteError
- type DeleteObjectEntry
- type DeleteObjectResult
- type DeleteObjectsRequest
- type DeleteObjectsResult
- type DeletedObject
- type Error
- type ErrorCode
- type GetObjectRequest
- type GetObjectResult
- type HeadObjectResult
- type ListObjectsRequest
- type ListObjectsResult
- type ListObjectsV2Request
- type ListObjectsV2Result
- type ObjectEntry
- type ObjectMetadata
- type ObjectOwner
- type PutObjectRequest
- type PutObjectResult
- type SSECParams
- type SSEKMSParams
- type Service
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound checks if an error is a not found error
func IsNotModified ¶
IsNotModified checks if an error is a not modified error
func IsPreconditionFailed ¶
IsPreconditionFailed checks if an error is a precondition failed error
Types ¶
type CRRHook ¶
type CRRHook interface {
AfterPutObject(ctx context.Context, bucketInfo interface{}, key, etag string, size int64)
AfterDeleteObject(ctx context.Context, bucketInfo interface{}, key string)
}
CRRHook defines callbacks for cross-region replication (enterprise feature). The bucketInfo parameter is of type *s3types.Bucket but uses interface{} to avoid import cycles.
type ConditionalResult ¶
type ConditionalResult struct {
ShouldProceed bool
StatusCode int // HTTP status code if ShouldProceed is false
NotModified bool // true for 304 Not Modified
}
ConditionalResult represents the result of evaluating conditional headers
type Config ¶
type Config struct {
DB db.DB
Storage *storage.Coordinator
Encryption *encryption.Handler
BucketStore *cache.BucketStore
DefaultProfile string
Profiles *types.ProfileSet
CRRHook CRRHook // Optional, enterprise feature
Emitter *events.Emitter // Optional, for S3 event notifications
BackendManager *backend.Manager // Optional, for reading transitioned objects
TaskQueue taskqueue.Queue // Optional, for intelligent tiering promotions
}
Config holds configuration for the object service
type CopyObjectRequest ¶
type CopyObjectRequest struct {
SourceBucket string
SourceKey string
DestBucket string
DestKey string
// Directives
MetadataDirective string // "COPY" or "REPLACE"
TaggingDirective string // "COPY" or "REPLACE"
// Content-Type for destination object (used when MetadataDirective is REPLACE)
// If empty with REPLACE, defaults to application/octet-stream
ContentType string
// Metadata for destination object (used when MetadataDirective is REPLACE)
// Keys are lowercase header names without the x-amz-meta- prefix
// If nil with REPLACE, destination gets no user metadata
Metadata map[string]string
// Tags for destination object (used when TaggingDirective is REPLACE)
// If nil with REPLACE, destination gets no tags
Tags []Tag
// Storage class for destination object (optional)
// If not specified, inherits from source object
StorageClass string
// Conditional headers for source
CopySourceIfMatch string
CopySourceIfNoneMatch string
CopySourceIfModifiedSince *time.Time
CopySourceIfUnmodifiedSince *time.Time
// SSE-KMS encryption for destination (optional)
// If not specified and source is encrypted, copy the encryption
// If not specified and bucket has default encryption, use that
SSEKMS *SSEKMSParams
}
CopyObjectRequest contains parameters for copying an object
type CopyObjectResult ¶
type CopyObjectResult struct {
ETag string
LastModified time.Time
VersionID string
// SSE response info (if encryption was applied)
SSEAlgorithm string
SSEKMSKeyID string
SSEKMSContext string
SSECustomerKeyMD5 string
}
CopyObjectResult contains the result of copying an object
type DeleteError ¶
DeleteError represents a failed delete operation
type DeleteObjectEntry ¶
DeleteObjectEntry represents a single object to delete
type DeleteObjectResult ¶
DeleteObjectResult contains the result of deleting an object
type DeleteObjectsRequest ¶
type DeleteObjectsRequest struct {
Bucket string
Objects []DeleteObjectEntry
Quiet bool
}
DeleteObjectsRequest contains parameters for batch delete
type DeleteObjectsResult ¶
type DeleteObjectsResult struct {
Deleted []DeletedObject
Errors []DeleteError
}
DeleteObjectsResult contains the result of batch delete
type DeletedObject ¶
type DeletedObject struct {
Key string
VersionID string
DeleteMarker bool
DeleteMarkerVersionID string
}
DeletedObject represents a successfully deleted object
type Error ¶
Error represents a domain-level error
type ErrorCode ¶
type ErrorCode int
ErrorCode represents a domain-level error code
const ( ErrCodeNone ErrorCode = iota ErrCodeNotFound ErrCodeAlreadyExists ErrCodeAccessDenied ErrCodeValidation ErrCodePreconditionFailed ErrCodeNotModified ErrCodeRangeNotSatisfiable ErrCodeIncompleteBody ErrCodeInvalidStorageClass ErrCodeInvalidEncryption ErrCodeKMSError ErrCodeKMSKeyNotFound ErrCodeInvalidObjectState // Object is archived and requires restore ErrCodeInternalError )
type GetObjectRequest ¶
type GetObjectRequest struct {
Bucket string
Key string
VersionID string // Specific version to retrieve (empty for latest)
Range *ByteRange // nil for full object
// For SSE-C encrypted objects
SSEC *SSECParams
// For SSE-KMS key validation (optional)
SSEKMSKeyID string
// Conditional headers
IfMatch string
IfNoneMatch string
IfModifiedSince *time.Time
IfUnmodifiedSince *time.Time
}
GetObjectRequest contains parameters for retrieving an object
type GetObjectResult ¶
type GetObjectResult struct {
Object *types.ObjectRef
Body io.ReadCloser // Caller must close
Metadata *ObjectMetadata
// Range info (populated if range request)
Range *ByteRange
IsPartial bool
AcceptRanges string
}
GetObjectResult contains the result of retrieving an object
type HeadObjectResult ¶
type HeadObjectResult struct {
Object *types.ObjectRef
Metadata *ObjectMetadata
}
HeadObjectResult contains metadata for an object without the body
type ListObjectsRequest ¶
type ListObjectsRequest struct {
Bucket string
Prefix string
Delimiter string
Marker string
MaxKeys int
}
ListObjectsRequest contains parameters for listing objects (v1)
type ListObjectsResult ¶
type ListObjectsResult struct {
Name string
Prefix string
Marker string
NextMarker string
Delimiter string
MaxKeys int
IsTruncated bool
Contents []ObjectEntry
CommonPrefixes []string
}
ListObjectsResult contains the result of listing objects (v1)
type ListObjectsV2Request ¶
type ListObjectsV2Request struct {
Bucket string
Prefix string
Delimiter string
ContinuationToken string
StartAfter string
MaxKeys int
FetchOwner bool
}
ListObjectsV2Request contains parameters for listing objects (v2)
type ListObjectsV2Result ¶
type ListObjectsV2Result struct {
Name string
Prefix string
Delimiter string
MaxKeys int
KeyCount int
IsTruncated bool
ContinuationToken string
NextContinuationToken string
StartAfter string
Contents []ObjectEntry
CommonPrefixes []string
}
ListObjectsV2Result contains the result of listing objects (v2)
type ObjectEntry ¶
type ObjectEntry struct {
Key string
LastModified time.Time
ETag string
Size uint64
StorageClass string
Owner *ObjectOwner
}
ObjectEntry represents an object in a list result
type ObjectMetadata ¶
type ObjectMetadata struct {
ETag string
LastModified time.Time
Size uint64
ContentType string
StorageClass string
// Encryption metadata
SSEAlgorithm string
SSECustomerKeyMD5 string
SSEKMSKeyID string
SSEKMSContext string
// User-defined metadata (x-amz-meta-* headers)
Metadata map[string]string
}
ObjectMetadata contains object metadata for responses
type ObjectOwner ¶
ObjectOwner represents the owner of an object
type PutObjectRequest ¶
type PutObjectRequest struct {
Bucket string
Key string
Body io.Reader
ContentLength int64 // -1 if unknown (chunked encoding)
ContentType string // MIME type (defaults to application/octet-stream)
StorageClass string
Owner string
// ACL for the object (nil uses default private ACL)
ACL *s3types.AccessControlList
// User-defined metadata (x-amz-meta-* headers)
// Keys are lowercase header names without the x-amz-meta- prefix
Metadata map[string]string
// Encryption options (mutually exclusive)
SSEC *SSECParams
SSEKMS *SSEKMSParams
}
PutObjectRequest contains parameters for storing an object
type PutObjectResult ¶
type PutObjectResult struct {
ETag string
VersionID string
// Encryption metadata for response headers
SSEAlgorithm string
SSECustomerKeyMD5 string
SSEKMSKeyID string
SSEKMSContext string
}
PutObjectResult contains the result of storing an object
type SSECParams ¶
type SSECParams struct {
Algorithm string // "AES256"
Key []byte // 32 bytes for AES-256
KeyMD5 string // Base64-encoded MD5 of key
}
SSECParams contains SSE-C encryption parameters
type SSEKMSParams ¶
SSEKMSParams contains SSE-KMS encryption parameters
type Service ¶
type Service interface {
// PutObject stores an object and returns the result.
// For SSE-C/SSE-KMS, the body is encrypted before storage.
PutObject(ctx context.Context, req *PutObjectRequest) (*PutObjectResult, error)
// GetObject retrieves an object for reading.
// Returns a ReadCloser that the caller must close.
// For SSE-C/SSE-KMS encrypted objects, decryption is handled transparently.
GetObject(ctx context.Context, req *GetObjectRequest) (*GetObjectResult, error)
// HeadObject retrieves object metadata without the body.
HeadObject(ctx context.Context, bucket, key string) (*HeadObjectResult, error)
// DeleteObject soft-deletes an object.
// Returns nil if the object doesn't exist (S3 compatibility).
DeleteObject(ctx context.Context, bucket, key string) (*DeleteObjectResult, error)
// DeleteObjectWithVersion handles versioned delete operations.
// If versionID is empty and versioning is enabled, creates a delete marker.
// If versionID is provided, permanently deletes that specific version.
DeleteObjectWithVersion(ctx context.Context, bucket, key, versionID string) (*DeleteObjectResult, error)
// DeleteObjects batch deletes multiple objects.
DeleteObjects(ctx context.Context, req *DeleteObjectsRequest) (*DeleteObjectsResult, error)
// CopyObject copies an object within or between buckets.
// For server-side copy, no data transfer occurs.
CopyObject(ctx context.Context, req *CopyObjectRequest) (*CopyObjectResult, error)
// ListObjects lists objects using v1 API pagination.
ListObjects(ctx context.Context, req *ListObjectsRequest) (*ListObjectsResult, error)
// ListObjectsV2 lists objects using v2 API pagination.
ListObjectsV2(ctx context.Context, req *ListObjectsV2Request) (*ListObjectsV2Result, error)
}
Service defines the interface for object operations. This separates business logic from HTTP handling.
func NewService ¶
NewService creates a new object service