Documentation
¶
Overview ¶
Package object object/acl.go
Package object object/append.go
Package object object/compose.go
Package object object/copy.go
Package object object/delete.go
Package object provides object-level operations for the RustFS Go SDK.
It includes upload/download, metadata, tagging, versioning, and advanced object features.
Package object object/errors.go
Package object object/fputget.go
Package object object/get.go
Package object object/list.go
Package object object/lock.go
Package object object/multipart.go
Package object object/object.go
Package object object/options.go
Package object object/post_policy.go
Package object object/presign.go
Package object object/put.go
Package object object/restore.go
Package object object/select.go
Package object object/service.go
Package object object/stat.go
Package object object/tagging.go
Package object object/utils.go
Index ¶
- Variables
- func WithVersionID(versionID string) interface{}
- type CommonPrefix
- type CopyOption
- type CopyOptions
- type DeleteOption
- type DeleteOptions
- type DestinationInfo
- type GetOption
- type GetOptions
- type LegalHoldOption
- type LegalHoldOptions
- type ListBucketV2Result
- type ListOption
- type ListOptions
- type PresignOption
- type PresignOptions
- type PutOption
- func WithContentDisposition(disposition string) PutOption
- func WithContentEncoding(encoding string) PutOption
- func WithContentType(contentType string) PutOption
- func WithPartSize(size uint64) PutOption
- func WithSSE(encrypter sse.Encrypter) PutOption
- func WithSSEC(key []byte) PutOption
- func WithSSECustomer(keyB64, keyMD5 string) PutOption
- func WithSSEKMS(keyID string, context map[string]string) PutOption
- func WithSSES3() PutOption
- func WithStorageClass(class string) PutOption
- func WithUserMetadata(metadata map[string]string) PutOption
- func WithUserTags(tags map[string]string) PutOption
- type PutOptions
- type RetentionOption
- type RetentionOptions
- type Service
- type SourceInfo
- type StatOption
- type StatOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBucketName invalid bucket name ErrInvalidBucketName = errors.New("invalid bucket name") // ErrInvalidObjectName invalid object name ErrInvalidObjectName = errors.New("invalid object name") // ErrObjectNotFound object not found ErrObjectNotFound = errors.New("object not found") // ErrListStopped list operation stopped via stop channel ErrListStopped = errors.New("list stopped by stop channel") // ErrNotImplemented feature not implemented ErrNotImplemented = errors.New("not implemented yet") )
Functions ¶
func WithVersionID ¶
func WithVersionID(versionID string) interface{}
WithVersionID selects a specific object version (Get/Stat/Delete)
Types ¶
type CommonPrefix ¶
type CommonPrefix struct {
Prefix string `xml:"Prefix"`
}
CommonPrefix represents common prefix entry
type CopyOption ¶
type CopyOption func(*CopyOptions)
CopyOption applies copy option
func WithCopyMetadata ¶
func WithCopyMetadata(metadata map[string]string, replace bool) CopyOption
WithCopyMetadata sets destination metadata for copy
func WithCopySourceVersionID ¶
func WithCopySourceVersionID(versionID string) CopyOption
WithCopySourceVersionID sets the source version ID for a copy
type CopyOptions ¶
type CopyOptions struct {
// Source version ID
SourceVersionID string
// Destination metadata and tags
UserMetadata map[string]string
UserTags map[string]string
// Replace metadata and/or tagging instead of copying existing
ReplaceMetadata bool
ReplaceTagging bool
// Object header overrides
ContentType string
ContentEncoding string
ContentDisposition string
CacheControl string
Expires time.Time
// Storage class
StorageClass string
// Conditional copy headers
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
// Custom headers
CustomHeaders http.Header
}
CopyOptions controls server-side copy behavior
type DeleteOptions ¶
type DeleteOptions struct {
// Version ID
VersionID string
// Force delete when possible
ForceDelete bool
// Custom headers
CustomHeaders http.Header
}
DeleteOptions controls object deletion
type DestinationInfo ¶ added in v1.0.5
DestinationInfo describes the target object for composition.
type GetOption ¶
type GetOption func(*GetOptions)
GetOption applies download option
func WithGetRange ¶
WithGetRange sets byte range for downloads
func WithGetSSE ¶ added in v1.0.5
WithGetSSE sets server-side encryption for downloads of encrypted objects
func WithGetSSEC ¶ added in v1.0.5
WithGetSSEC enables SSE-C decryption for downloads
func WithGetSSECustomer ¶ added in v1.0.3
WithGetSSECustomer sets SSE-C parameters for downloads (key must be base64 encoded)
type GetOptions ¶
type GetOptions struct {
// Range header
RangeStart int64
RangeEnd int64
SetRange bool
// Version ID
VersionID string
// Conditional headers
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
// Custom headers
CustomHeaders http.Header
// Server-side encryption for encrypted objects
SSE sse.Encrypter
// SSE-C headers for encrypted objects (deprecated, use SSE field)
SSECustomerAlgorithm string
SSECustomerKey string
SSECustomerKeyMD5 string
}
GetOptions controls object download behavior
type LegalHoldOption ¶ added in v1.0.5
type LegalHoldOption func(*LegalHoldOptions)
LegalHoldOption applies legal hold options
func WithLegalHoldVersionID ¶ added in v1.0.5
func WithLegalHoldVersionID(versionID string) LegalHoldOption
WithLegalHoldVersionID targets a specific object version for legal hold operations.
type LegalHoldOptions ¶ added in v1.0.5
type LegalHoldOptions struct {
VersionID string
}
LegalHoldOptions controls legal hold operations.
type ListBucketV2Result ¶
type ListBucketV2Result struct {
XMLName xml.Name `xml:"ListBucketResult"`
Name string `xml:"Name"`
Prefix string `xml:"Prefix"`
KeyCount int `xml:"KeyCount"`
MaxKeys int `xml:"MaxKeys"`
Delimiter string `xml:"Delimiter"`
IsTruncated bool `xml:"IsTruncated"`
Contents []types.ObjectInfo `xml:"Contents"`
CommonPrefixes []CommonPrefix `xml:"CommonPrefixes"`
ContinuationToken string `xml:"ContinuationToken"`
NextContinuationToken string `xml:"NextContinuationToken"`
StartAfter string `xml:"StartAfter"`
}
ListBucketV2Result represents bucket listing V2 response
type ListOption ¶
type ListOption func(*ListOptions)
ListOption applies list option
func WithListMaxKeys ¶
func WithListMaxKeys(maxKeys int) ListOption
WithListMaxKeys sets the maximum keys to return
func WithListMetadata ¶ added in v1.0.4
func WithListMetadata(include bool) ListOption
WithListMetadata includes object metadata in list results when supported
func WithListPrefix ¶
func WithListPrefix(prefix string) ListOption
WithListPrefix sets listing prefix
func WithListRecursive ¶
func WithListRecursive(recursive bool) ListOption
WithListRecursive toggles recursive listing
func WithListStopChan ¶ added in v1.0.4
func WithListStopChan(ch <-chan struct{}) ListOption
WithListStopChan sets a channel to stop listing early
func WithListVersions ¶ added in v1.0.4
func WithListVersions() ListOption
WithListVersions lists object versions instead of current objects
type ListOptions ¶
type ListOptions struct {
// Prefix filter
Prefix string
// Recursive listing
Recursive bool
// StopChan is an optional signal channel to stop listing early
StopChan <-chan struct{}
// Max keys
MaxKeys int
// Start token
StartAfter string
// Use ListObjectsV2
UseV2 bool
// Include object versions
WithVersions bool
// Include object metadata
WithMetadata bool
// Custom headers
CustomHeaders http.Header
}
ListOptions controls object listing
type PresignOption ¶ added in v1.0.3
type PresignOption func(*PresignOptions)
PresignOption applies presign options
func WithPresignHeaders ¶ added in v1.0.3
func WithPresignHeaders(headers http.Header) PresignOption
WithPresignHeaders adds headers that must be signed for the presigned URL
func WithPresignQuery ¶ added in v1.0.3
func WithPresignQuery(values url.Values) PresignOption
WithPresignQuery adds additional query parameters (e.g., response-content-type)
func WithPresignSSECustomer ¶ added in v1.0.3
func WithPresignSSECustomer(keyB64, keyMD5 string) PresignOption
WithPresignSSECustomer signs SSE-C headers for presigned requests (key must be base64 encoded)
func WithPresignSSES3 ¶ added in v1.0.3
func WithPresignSSES3() PresignOption
WithPresignSSES3 signs SSE-S3 header for presigned requests
type PresignOptions ¶ added in v1.0.3
PresignOptions controls presigned URL generation
type PutOption ¶
type PutOption func(*PutOptions)
PutOption applies upload option
func WithContentDisposition ¶
WithContentDisposition sets Content-Disposition
func WithContentEncoding ¶
WithContentEncoding sets Content-Encoding
func WithContentType ¶
WithContentType sets Content-Type
func WithSSECustomer ¶ added in v1.0.3
WithSSECustomer provides SSE-C parameters for uploads (key must be base64 encoded)
func WithSSEKMS ¶ added in v1.0.5
WithSSEKMS enables SSE-KMS (AWS KMS) encryption
func WithSSES3 ¶ added in v1.0.3
func WithSSES3() PutOption
WithSSES3 enables SSE-S3 server-side encryption for uploads
func WithStorageClass ¶
WithStorageClass sets storage class
func WithUserMetadata ¶
WithUserMetadata sets user metadata
func WithUserTags ¶
WithUserTags sets object tags
type PutOptions ¶
type PutOptions struct {
// Content-Type
ContentType string
// Content-Encoding
ContentEncoding string
// Content-Disposition
ContentDisposition string
// Content-Language
ContentLanguage string
// Cache-Control
CacheControl string
// Expiration time
Expires time.Time
// User metadata
UserMetadata map[string]string
// User tags
UserTags map[string]string
// Storage class
StorageClass string
// Custom headers
CustomHeaders http.Header
// Whether to send Content-MD5
SendContentMD5 bool
// Disable Content-SHA256
DisableContentSHA256 bool
// Server-side encryption
SSE sse.Encrypter
// SSE-S3 / SSE-C options (deprecated, use SSE field)
SSECustomerAlgorithm string
SSECustomerKey string
SSECustomerKeyMD5 string
// Multipart part size
PartSize uint64
// Number of concurrent uploads
NumThreads uint
// contains filtered or unexported fields
}
PutOptions controls object upload behavior
type RetentionOption ¶ added in v1.0.5
type RetentionOption func(*RetentionOptions)
RetentionOption applies retention options
func WithGovernanceBypass ¶ added in v1.0.5
func WithGovernanceBypass() RetentionOption
WithGovernanceBypass bypasses governance retention restrictions.
func WithRetentionVersionID ¶ added in v1.0.5
func WithRetentionVersionID(versionID string) RetentionOption
WithRetentionVersionID targets a specific object version for retention operations.
type RetentionOptions ¶ added in v1.0.5
RetentionOptions controls retention operations.
type Service ¶
type Service interface {
// Put uploads an object
Put(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts ...PutOption) (types.UploadInfo, error)
// Get downloads an object
Get(ctx context.Context, bucketName, objectName string, opts ...GetOption) (io.ReadCloser, types.ObjectInfo, error)
// FPut uploads a file from a local path
FPut(ctx context.Context, bucketName, objectName, filePath string, opts ...PutOption) (types.UploadInfo, error)
// FGet downloads an object to a local file path
FGet(ctx context.Context, bucketName, objectName, filePath string, opts ...GetOption) (types.ObjectInfo, error)
// Stat retrieves object info
Stat(ctx context.Context, bucketName, objectName string, opts ...StatOption) (types.ObjectInfo, error)
// Delete removes an object
Delete(ctx context.Context, bucketName, objectName string, opts ...DeleteOption) error
// List lists objects
List(ctx context.Context, bucketName string, opts ...ListOption) <-chan types.ObjectInfo
// ListVersions lists object versions and delete markers
ListVersions(ctx context.Context, bucketName string, opts ...ListOption) <-chan types.ObjectInfo
// Copy copies an object
Copy(ctx context.Context, destBucket, destObject, srcBucket, srcObject string, opts ...CopyOption) (types.CopyInfo, error)
// Compose creates an object by composing source objects
Compose(ctx context.Context, dst DestinationInfo, sources []SourceInfo, opts ...PutOption) (types.UploadInfo, error)
// Append appends data to an object at a specific offset
Append(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, offset int64, opts ...PutOption) (types.UploadInfo, error)
// Select queries object content using S3 Select
Select(ctx context.Context, bucketName, objectName string, opts s3select.Options) (*s3select.Results, error)
// Restore initiates a restore request for an archived object
Restore(ctx context.Context, bucketName, objectName, versionID string, req restore.RestoreRequest) error
// PresignedPostPolicy creates a presigned POST policy for browser uploads
PresignedPostPolicy(ctx context.Context, policy *policy.PostPolicy) (*url.URL, map[string]string, error)
// PresignGet creates a presigned GET URL with optional signed headers
PresignGet(ctx context.Context, bucketName, objectName string, expires time.Duration, reqParams url.Values, opts ...PresignOption) (*url.URL, http.Header, error)
// PresignPut creates a presigned PUT URL with optional signed headers
PresignPut(ctx context.Context, bucketName, objectName string, expires time.Duration, reqParams url.Values, opts ...PresignOption) (*url.URL, http.Header, error)
// SetTagging sets object tags
SetTagging(ctx context.Context, bucketName, objectName string, tags map[string]string) error
// GetTagging retrieves object tags
GetTagging(ctx context.Context, bucketName, objectName string) (map[string]string, error)
// DeleteTagging deletes object tags
DeleteTagging(ctx context.Context, bucketName, objectName string) error
// GetACL retrieves object ACL
GetACL(ctx context.Context, bucketName, objectName string) (acl.ACL, error)
// SetACL sets object ACL
SetACL(ctx context.Context, bucketName, objectName string, policy acl.ACL) error
// SetLegalHold sets legal hold status for an object
SetLegalHold(ctx context.Context, bucketName, objectName string, hold objectlock.LegalHoldStatus, opts ...LegalHoldOption) error
// GetLegalHold retrieves legal hold status for an object
GetLegalHold(ctx context.Context, bucketName, objectName string, opts ...LegalHoldOption) (objectlock.LegalHoldStatus, error)
// SetRetention sets retention mode and retain-until date for an object
SetRetention(ctx context.Context, bucketName, objectName string, mode objectlock.RetentionMode, retainUntil time.Time, opts ...RetentionOption) error
// GetRetention retrieves retention configuration for an object
GetRetention(ctx context.Context, bucketName, objectName string, opts ...RetentionOption) (objectlock.RetentionMode, time.Time, error)
}
Service Object service interface
func NewService ¶
func NewService(executor *core.Executor, locationCache *cache.LocationCache) Service
NewService creates a new Object service
type SourceInfo ¶ added in v1.0.5
type SourceInfo struct {
Bucket string
Object string
VersionID string
RangeStart int64
RangeEnd int64
RangeSet bool
MatchETag string
NotMatchETag string
MatchModified time.Time
NotModified time.Time
}
SourceInfo describes a source object for composition.
type StatOptions ¶
type StatOptions struct {
// Version ID
VersionID string
// Custom headers
CustomHeaders http.Header
}
StatOptions controls stat/metadata retrieval