util

package
v0.33.7 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUploadProgress

func CheckUploadProgress(ctx context.Context, httpClient *safeClient.SafeClient, targetURL string) (int64, error)

func CreateDataImport

func CreateDataImport(
	ctx context.Context,
	name, namespace, ttl string,
	publish, waitForFirstConsumer bool,
	pvcTpl *v1alpha1.PersistentVolumeClaimTemplateSpec,
	rtClient ctrlrtclient.Client,
) error

func DeleteDataImport

func DeleteDataImport(ctx context.Context, diName, namespace string, rtClient ctrlrtclient.Client) error

func EnsureDataImportPublish added in v0.29.8

func EnsureDataImportPublish(
	ctx context.Context,
	diObj *v1alpha1.DataImport,
	publish bool,
	rtClient ctrlrtclient.Client,
) error

EnsureDataImportPublish patches DataImport.Spec.Publish to match the resolved value. Only upgrades publish: false -> true is patched, true -> false is intentionally skipped to avoid downgrading already-published resources.

func GetDataImport

func GetDataImport(ctx context.Context, diName, namespace string, rtClient ctrlrtclient.Client) (*v1alpha1.DataImport, error)

func GetDataImportWithRestart

func GetDataImportWithRestart(
	ctx context.Context,
	diName, namespace string,
	rtClient ctrlrtclient.Client,
	log *slog.Logger,
) (*v1alpha1.DataImport, error)

func PostFinished added in v0.33.7

func PostFinished(ctx context.Context, httpClient *safeClient.SafeClient, baseURL string) error

PostFinished signals end-of-upload to the importer (POST <baseURL>/api/v1/finished), which flips the DataImport's serverState to Finished. This is mandatory: the last data chunk (a PUT that fills the device / writes the final file) does NOT finalise on its own, and the controller only sets UploadFinished=True — the gate for rebinding the target and reaching Completed — once serverState is Finished. baseURL is the importer base (status.url / status.publicURL), the same base the /api/v1/{files,block} data endpoint hangs off of.

func PrepareUpload

func PrepareUpload(
	ctx context.Context,
	diName, namespace string,
	publish bool,
	sClient *safeClient.SafeClient,
	log *slog.Logger,
) (string, string, string, *safeClient.SafeClient, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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