Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultExample(scheme string) string
- func DefaultValidationRegex(scheme string) string
- func JoinPathParts(parts []string) string
- type Adapter
- type CompleteMultiPartUploadResponse
- type CreateMultiPartUploadOpts
- type CreateMultiPartUploadResponse
- type HashingReader
- type IdentifierType
- type Inventory
- type InventoryGenerator
- type InventoryIterator
- type InventoryObject
- type MultipartPart
- type MultipartUploadCompletion
- type ObjectPointer
- type Path
- type PreSignMode
- type Properties
- type PutOpts
- type QualifiedKey
- type QualifiedPrefix
- type StorageNamespaceInfo
- type StorageType
- type UploadPartResponse
- type WalkFunc
- type WalkOpts
Constants ¶
const ( BlockstoreTypeS3 = "s3" BlockstoreTypeGS = "gs" BlockstoreTypeAzure = "azure" BlockstoreTypeLocal = "local" BlockstoreTypeMem = "mem" BlockstoreTypeTransient = "transient" )
const ( HashFunctionMD5 = iota HashFunctionSHA256 )
const ( StorageTypeMem = iota StorageTypeLocal StorageTypeS3 StorageTypeGS StorageTypeAzure )
const ( Separator = "/" EntryTypeTree = "tree" EntryTypeObject = "object" )
const DefaultPreSignExpiryDuration = time.Minute * 15
DefaultPreSignExpiryDuration is the amount of time pre-signed requests are valid for.
Variables ¶
var ( ErrDataNotFound = errors.New("not found") ErrOperationNotSupported = errors.New("operation not supported") )
var ErrInvalidNamespace = errors.New("invalid namespace")
var RootPath = NewPath("", EntryTypeTree)
Functions ¶
func DefaultExample ¶
func DefaultValidationRegex ¶
func JoinPathParts ¶
Types ¶
type Adapter ¶
type Adapter interface { InventoryGenerator Put(ctx context.Context, obj ObjectPointer, sizeBytes int64, reader io.Reader, opts PutOpts) error Get(ctx context.Context, obj ObjectPointer, expectedSize int64) (io.ReadCloser, error) GetPreSignedURL(ctx context.Context, obj ObjectPointer, mode PreSignMode) (string, error) Walk(ctx context.Context, walkOpt WalkOpts, walkFn WalkFunc) error Exists(ctx context.Context, obj ObjectPointer) (bool, error) GetRange(ctx context.Context, obj ObjectPointer, startPosition int64, endPosition int64) (io.ReadCloser, error) GetProperties(ctx context.Context, obj ObjectPointer) (Properties, error) Remove(ctx context.Context, obj ObjectPointer) error Copy(ctx context.Context, sourceObj, destinationObj ObjectPointer) error CreateMultiPartUpload(ctx context.Context, obj ObjectPointer, r *http.Request, opts CreateMultiPartUploadOpts) (*CreateMultiPartUploadResponse, error) UploadPart(ctx context.Context, obj ObjectPointer, sizeBytes int64, reader io.Reader, uploadID string, partNumber int) (*UploadPartResponse, error) UploadCopyPart(ctx context.Context, sourceObj, destinationObj ObjectPointer, uploadID string, partNumber int) (*UploadPartResponse, error) UploadCopyPartRange(ctx context.Context, sourceObj, destinationObj ObjectPointer, uploadID string, partNumber int, startPosition, endPosition int64) (*UploadPartResponse, error) AbortMultiPartUpload(ctx context.Context, obj ObjectPointer, uploadID string) error CompleteMultiPartUpload(ctx context.Context, obj ObjectPointer, uploadID string, multipartList *MultipartUploadCompletion) (*CompleteMultiPartUploadResponse, error) BlockstoreType() string GetStorageNamespaceInfo() StorageNamespaceInfo RuntimeStats() map[string]string }
type CompleteMultiPartUploadResponse ¶ added in v0.54.0
type CompleteMultiPartUploadResponse struct { ETag string ContentLength int64 ServerSideHeader http.Header }
CompleteMultiPartUploadResponse complete multipart etag, content length and additional headers (implementation specific) currently it targets s3. The ETag is a hex string value of the content checksum
type CreateMultiPartUploadOpts ¶
type CreateMultiPartUploadOpts struct {
StorageClass *string // S3 storage class
}
CreateMultiPartUploadOpts contains optional arguments for CreateMultiPartUpload. These should be analogous to options on some underlying storage layer. Missing arguments are mapped to the default if a storage layer implements the option.
If the same CreateMultiPartUpload command is implemented multiple times with the same contents but different option values, the first supplied option value is retained.
type CreateMultiPartUploadResponse ¶ added in v0.54.0
CreateMultiPartUploadResponse multipart upload ID and additional headers (implementation specific) currently it targets s3 capabilities to enable encryption properties
type HashingReader ¶
type HashingReader struct { Md5 hash.Hash Sha256 hash.Hash CopiedSize int64 // contains filtered or unexported fields }
func NewHashingReader ¶
func NewHashingReader(body io.Reader, hashTypes ...int) *HashingReader
type IdentifierType ¶ added in v0.40.0
type IdentifierType int32
IdentifierType is the type the ObjectPointer Identifier
const ( // Deprecated: indicates that the identifier might be relative or full. IdentifierTypeUnknownDeprecated IdentifierType = 0 // IdentifierTypeRelative indicates that the address is relative to the storage namespace. // For example: "/foo/bar" IdentifierTypeRelative IdentifierType = 1 // IdentifierTypeFull indicates that the address is the full address of the object in the object store. // For example: "s3://bucket/foo/bar" IdentifierTypeFull IdentifierType = 2 )
type Inventory ¶
type Inventory interface { Iterator() InventoryIterator SourceName() string InventoryURL() string }
Inventory represents a snapshot of the storage space
type InventoryGenerator ¶
type InventoryIterator ¶
type InventoryIterator interface { cmdutils.ProgressReporter Next() bool Err() error Get() *InventoryObject }
type InventoryObject ¶
type MultipartPart ¶ added in v0.55.0
MultipartPart single multipart information
type MultipartUploadCompletion ¶
type MultipartUploadCompletion struct {
Part []MultipartPart
}
MultipartUploadCompletion parts described as part of complete multipart upload. Each part holds the part number and ETag received while calling part upload. NOTE that S3 implementation and our S3 gateway accept and returns ETag value surrounded with double-quotes ("), while the adapter implementations supply the raw value of the etag (without double quotes) and let the gateway manage the s3 protocol specifications.
type ObjectPointer ¶
type ObjectPointer struct { StorageNamespace string Identifier string // Indicates whether the Identifier is relative to the StorageNamespace, // full address to an object, or unknown. IdentifierType IdentifierType }
ObjectPointer is a unique identifier of an object in the object store: the store is a 1:1 mapping between pointers and objects.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
func (*Path) ParentPath ¶
type PreSignMode ¶ added in v0.90.0
type PreSignMode int32
PreSignMode is the mode to use when generating a pre-signed URL (read/write)
const ( PreSignModeRead PreSignMode = iota PreSignModeWrite )
type Properties ¶
type Properties struct {
StorageClass *string
}
Properties of an object stored on the underlying block store. Refer to the actual underlying Adapter for which properties are actually reported.
type PutOpts ¶
type PutOpts struct {
StorageClass *string // S3 storage class
}
PutOpts contains optional arguments for Put. These should be analogous to options on some underlying storage layer. Missing arguments are mapped to the default if a storage layer implements the option.
If the same Put command is implemented multiple times with the same contents but different option values, the first supplied option value is retained.
type QualifiedKey ¶
type QualifiedKey struct { StorageType StorageType StorageNamespace string Key string }
func ResolveNamespace ¶
func ResolveNamespace(defaultNamespace, key string, identifierType IdentifierType) (QualifiedKey, error)
func (QualifiedKey) Format ¶
func (qk QualifiedKey) Format() string
type QualifiedPrefix ¶
type QualifiedPrefix struct { StorageType StorageType StorageNamespace string Prefix string }
func ResolveNamespacePrefix ¶
func ResolveNamespacePrefix(defaultNamespace, prefix string) (QualifiedPrefix, error)
type StorageNamespaceInfo ¶
type StorageNamespaceInfo struct { ValidityRegex string // regex pattern that could be used to validate the namespace Example string // example of a valid namespace PreSignSupport bool }
func DefaultStorageNamespaceInfo ¶
func DefaultStorageNamespaceInfo(scheme string) StorageNamespaceInfo
type StorageType ¶
type StorageType int
func GetStorageType ¶
func GetStorageType(namespaceURL *url.URL) (StorageType, error)
func (StorageType) BlockstoreType ¶ added in v0.45.1
func (s StorageType) BlockstoreType() string
func (StorageType) Scheme ¶ added in v0.45.1
func (s StorageType) Scheme() string
type UploadPartResponse ¶ added in v0.54.0
UploadPartResponse upload part ETag and additional headers (implementation specific) currently it targets s3 capabilities to enable encryption properties The ETag is a hex string value of the content checksum
type WalkFunc ¶
WalkFunc is called for each object visited by the Walk. The id argument contains the argument to Walk as a prefix; that is, if Walk is called with "test/data/", which is a prefix containing the object "test/data/a", the walk function will be called with argument "test/data/a". If there was a problem walking to the object, the incoming error will describe the problem and the function can decide how to handle that error. If an error is returned, processing stops.