Documentation
¶
Overview ¶
Package objval provides types/definitions used by 'objstore'.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrByteRangeRequired = errors.New("a byte range is required but hasn't been provided")
ErrByteRangeRequired is returned when a function which requires a byte range hasn't been provided with one.
Functions ¶
This section is empty.
Types ¶
type BucketLockingStatus ¶
type BucketLockingStatus struct {
// Enabled - if set to true then object locking must be enabled for the bucket.
Enabled bool
}
BucketLockingStatus represents the bucket-level object locking metadata.
type ByteRange ¶
ByteRange represents a byte range of an object in the HTTP range header format. For more information on the format see 'https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35'.
func (*ByteRange) ToOffsetLength ¶
ToOffsetLength returns the offset/length representation of this byte range.
func (*ByteRange) ToRangeHeader ¶
ToRangeHeader returns the HTTP range header representation of this byte range.
type InvalidByteRangeError ¶
type InvalidByteRangeError struct {
ByteRange *ByteRange
}
InvalidByteRangeError is returned if a byte range is invalid for some reason.
func (*InvalidByteRangeError) Error ¶
func (e *InvalidByteRangeError) Error() string
Error implements the 'error' interface.
type Object ¶
type Object struct {
ObjectAttrs
// This body will generally be a HTTP response body; it should be read once, and closed to avoid resource leaks.
//
// NOTE: Depending on the request type, this may not be the entire body of the object, just a byte range.
Body io.ReadCloser
}
Object represents an object stored in the cloud, simply the attributes and it's body.
type ObjectAttrs ¶
type ObjectAttrs struct {
// Key is the identifier for the object; a unique path.
Key string
// ETag is the HTTP entity tag for the object, each cloud provider uses this differently with different rules also
// applying to different scenarios (e.g. multipart uploads).
//
// NOTE: Not populated during object iteration.
ETag *string
// Size is the size or content length of the object in bytes.
//
// NOTE: May be conditionally populated by 'GetObject', for example when a chunked response is returned, this
// attribute will be <nil>.
Size *int64
// LastModified is the time the object was last updated (or created).
//
// NOTE: The semantics of this attribute may differ between cloud providers (e.g. an change of metadata might bump
// the last modified time).
LastModified *time.Time
// VersionID is used to identify a specific version when object versioning is enabled.
VersionID string
// LockExpiration is the time the object lock will expire.
LockExpiration *time.Time
// LockType is the type of the object lock.
LockType LockType
// IsCurrentVersion is used to determine whether this is the latest
// version of the object. Only available when iterating object versions on AWS and Azure.
IsCurrentVersion bool
// IsDeleteMarker determines whether this describes a delete marker instead of an object or a version.
IsDeleteMarker bool
// CAS is the value to use when doing a conditional-write, i.e. what to pass as the 'PreconditionData' when doing a
// 'PutObject' with 'OperationPreconditionIfMatch'.
//
// NOTE: Not populated during object iteration.
CAS string
}
ObjectAttrs represents the attributes usually attached to an object in the cloud.
func (*ObjectAttrs) IsDir ¶
func (o *ObjectAttrs) IsDir() bool
IsDir returns a boolean indicating whether these attributes represent a synthetic directory, created by the library when iterating objects using a 'delimiter'. When 'IsDir' returns 'true', only the 'Key' attribute will be populated.
NOTE: This does not, and will not indicate whether the remote object is itself a directory stub; a zero length object created by the AWS WebUI.
type ObjectVersion ¶
type ObjectVersion struct {
// Key is the identifier for the object; a unique path.
Key string
// VersionID is used to identify a specific version when object versioning is enabled.
VersionID string
}
ObjectVersion represents a version of an object.
type Part ¶
type Part struct {
// ID is a unique identifier, which is used by each client when completing the multipart upload; this will be an
// entity tag for some clients, and a generated key for others.
ID string
// Number is a number between 1-10,000 which can be used for ordering parts when a multipart upload is completed.
//
// NOTE: This field will not be populated in functions which fetch a list of parts from remote cloud providers.
Number int
// Size is the size of the part in bytes.
Size int64
}
Part represents the metadata from a single part from a multipart upload.
type Provider ¶
type Provider int
Provider represents a cloud provider.
const ( // ProviderNone means not using a provider e.g. using the local filesystem. ProviderNone Provider = iota // ProviderAWS is the AWS cloud provider. ProviderAWS // ProviderGCP is the Google Cloud Platform cloud provider. ProviderGCP // ProviderAzure is the Microsoft Azure cloud provider. ProviderAzure )
type TestBucket ¶
type TestBucket map[TestObjectIdentifier]*TestObject
TestBucket represents a bucket and is only used by the 'TestClient' to store objects in memory.
type TestBuckets ¶
type TestBuckets map[string]TestBucket
TestBuckets represents a number of buckets, and is only used by the 'TestClient' to store state in memory.
type TestObject ¶
type TestObject struct {
ObjectAttrs
// Body is data contained in the test object.
Body []byte
}
TestObject represents an object and is only used by the 'TestObject'.
type TestObjectIdentifier ¶
type TestObjectIdentifier struct {
// Key is the object key.
Key string
// VersionID identifies the specific object version. If empty the identifier refers to the current version.
VersionID string
}
TestObjectIdentifier identifies an object or an object version and is only used by the 'TestObject'.