upload

package
v0.3.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFile

func RegisterFile(ctx context.Context, bk UploadBackend, dc MetadataClient, drsObject *drsapi.DrsObject, filePath, bucketName string, canonicalLocation ...string) (*drsapi.DrsObject, error)

RegisterFile uploads filePath and registers drsObject with the DRS server. canonicalLocation overrides URL resolution from the uploaded location.

func ReplaceFile added in v0.3.9

func ReplaceFile(ctx context.Context, bk UploadBackend, dc MetadataClient, drsObject *drsapi.DrsObject, filePath, bucketName, expectedOldSHA string, canonicalLocation ...string) (*drsapi.DrsObject, error)

ReplaceFile uploads bytes first, then atomically replaces the existing DID only if its checksum still matches the preflight value.

func Upload

func Upload(ctx context.Context, backend transfer.MultipartBackend, sourcePath, objectKey, guid, bucket string, metadata common.FileMetadata, _ bool, forceMultipart bool) error

Upload forwards an upload to the transfer engine. Deprecated: use engine.GenericUploader.Upload with a transfer.TransferRequest. The unused boolean remains for compatibility with published client versions.

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)
	ReplaceObject(ctx context.Context, objectID, expectedOldSHA string, candidate drsapi.DrsObjectCandidate) (drsapi.DrsObject, error)
	UpdateObjectAccessMethods(ctx context.Context, objectID string, accessMethods []drsapi.AccessMethod) (drsapi.DrsObject, error)
}

type UploadBackend

type UploadBackend interface {
	transfer.MultipartBackend
	ResolveUploadURL(ctx context.Context, guid, filename string, metadata common.FileMetadata, bucket string) (string, error)
	CanonicalObjectURL(signedURL, bucketHint, fallbackDID string) (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL