Documentation
¶
Index ¶
- func FormatSize(size int64) string
- func OptimalChunkSize(fileSize int64) int64
- func ProcessFilename(logger transfer.TransferLogger, uploadPath string, filePath string, ...) (string, string, common.FileMetadata, error)
- func RegisterFile(ctx context.Context, bk UploadBackend, dc MetadataClient, ...) (*drsapi.DrsObject, error)
- func SeparateSingleAndMultipartUploads(bk interface{ ... }, objects []uploadRequest) ([]uploadRequest, []uploadRequest)
- func Upload(ctx context.Context, bk transfer.MultipartBackend, ...) error
- func UploadSingle(ctx context.Context, bk transfer.Uploader, logger transfer.TransferLogger, ...) error
- func UploadWithOptions(ctx context.Context, bk transfer.MultipartBackend, ...) error
- type MetadataClient
- type RenamedOrSkippedFileInfo
- type UploadBackend
- type UploadConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSize ¶
FormatSize helps to parse a int64 size into string
func OptimalChunkSize ¶
OptimalChunkSize returns a recommended chunk size for the given fileSize (in bytes).
func ProcessFilename ¶
func ProcessFilename(logger transfer.TransferLogger, uploadPath string, filePath string, objectId string, includeSubDirName bool, includeMetadata bool) (string, string, common.FileMetadata, error)
ProcessFilename returns an FileInfo object which has the information about the path and name to be used for upload of a file
func RegisterFile ¶
func RegisterFile(ctx context.Context, bk UploadBackend, dc MetadataClient, drsObject *drsapi.DrsObject, filePath string, bucketName string) (*drsapi.DrsObject, error)
RegisterFile orchestrates the full registration and upload flow: 1. Build a DRS object from the local file (if not provided). 2. Register metadata with the DRS server via the provided drs.Client. 3. Upload the file content via the provided Backend.
func SeparateSingleAndMultipartUploads ¶
func SeparateSingleAndMultipartUploads(bk interface {
Logger() transfer.TransferLogger
}, objects []uploadRequest) ([]uploadRequest, []uploadRequest)
func Upload ¶
func Upload(ctx context.Context, bk transfer.MultipartBackend, sourcePath, objectKey, guid, bucket string, metadata common.FileMetadata, showProgress bool, forceMultipart bool) error
Upload is now a thin wrapper around the generic EngineUploader.
func UploadSingle ¶
func UploadSingle(ctx context.Context, bk transfer.Uploader, logger transfer.TransferLogger, sourcePath, objectKey, guid, bucket string, metadata common.FileMetadata, showProgress bool) error
UploadSingle is a compatibility shim that preserves the old entrypoint while routing the actual byte transfer through the shared engine uploader.
func UploadWithOptions ¶
func UploadWithOptions(ctx context.Context, bk transfer.MultipartBackend, sourcePath, objectKey, guid, bucket string, metadata common.FileMetadata, showProgress bool, forceMultipart bool) error
Types ¶
type MetadataClient ¶
type MetadataClient interface {
GetObject(ctx context.Context, objectID string) (drsapi.DrsObject, error)
RegisterObjects(ctx context.Context, req drsapi.RegisterObjectsJSONRequestBody) (drsapi.N201ObjectsCreated, error)
UpdateObjectAccessMethods(ctx context.Context, objectID string, accessMethods []drsapi.AccessMethod) (drsapi.DrsObject, error)
}
type RenamedOrSkippedFileInfo ¶
RenamedOrSkippedFileInfo is a helper struct for recording renamed or skipped files
type UploadBackend ¶
type UploadBackend interface {
transfer.Uploader
transfer.MultipartBackend
}