client

package
v2.8.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName1          = "foo1"
	FileName2          = "foo2"
	FileName3          = "foo3"
	ExplicitDirName    = "explicit"
	ExplicitFileName1  = "explicitFile1"
	ImplicitDirName    = "implicit"
	ImplicitFileName1  = "implicitFile1"
	FileContents       = "testString"
	SizeOfFileContents = 10
	GCSFileContent     = "GCSteststring"
	GCSFileSize        = 13
	FilePerms          = 0644
	ReadSize           = 1024
	SizeTruncate       = 5
	NewFileName        = "newName"
	NewDirName         = "newDirName"
)

Variables

This section is empty.

Functions

func CloseFileAndValidateContentFromGCS

func CloseFileAndValidateContentFromGCS(ctx context.Context, storageClient *storage.Client,
	fh *os.File, testDirName, fileName, content string, t *testing.T)

func CreateImplicitDir

func CreateImplicitDir(ctx context.Context, storageClient *storage.Client,
	testDirName string, t *testing.T)

func CreateLocalFileInTestDir

func CreateLocalFileInTestDir(ctx context.Context, storageClient *storage.Client,
	testDirPath, fileName string, t *testing.T) (string, *os.File)

func CreateNFilesInDir

func CreateNFilesInDir(ctx context.Context, storageClient *storage.Client, numFiles int, fileName string, fileSize int64, dirName string, t *testing.T) (fileNames []string)

func CreateObjectInGCSTestDir

func CreateObjectInGCSTestDir(ctx context.Context, storageClient *storage.Client,
	testDirName, fileName, content string, t *testing.T)

func CreateObjectOnGCS

func CreateObjectOnGCS(ctx context.Context, client *storage.Client, object, content string) error

CreateObjectOnGCS creates an object with given name and content on GCS.

func CreateStorageClient

func CreateStorageClient(ctx context.Context) (*storage.Client, error)

func CreateStorageClientWithTimeOut

func CreateStorageClientWithTimeOut(ctx *context.Context, storageClient **storage.Client, time time.Duration, t *testing.T) func()

CreateStorageClientWithTimeOut creates storage client with a configurable timeout and return a function to cancel the storage client

func DeleteAllObjectsWithPrefix

func DeleteAllObjectsWithPrefix(ctx context.Context, client *storage.Client, prefix string) error

func DeleteObjectOnGCS

func DeleteObjectOnGCS(ctx context.Context, client *storage.Client, objectName string) error

func DownloadObjectFromGCS

func DownloadObjectFromGCS(gcsFile string, destFileName string, t *testing.T) error

DownloadObjectFromGCS downloads an object to a local file.

func GetDirName

func GetDirName(testDirPath string) string

func ReadChunkFromGCS

func ReadChunkFromGCS(ctx context.Context, client *storage.Client, object string,
	offset, size int64) (string, error)

ReadChunkFromGCS downloads the object chunk from GCS and returns the data.

func ReadObjectFromGCS

func ReadObjectFromGCS(ctx context.Context, client *storage.Client, object string) (string, error)

ReadObjectFromGCS downloads the object from GCS and returns the data.

func SetupFileInTestDirectory

func SetupFileInTestDirectory(ctx context.Context, storageClient *storage.Client,
	testDirName, testFileName string, size int64, t *testing.T)

func SetupTestDirectory

func SetupTestDirectory(ctx context.Context, storageClient *storage.Client, testDirName string) string

func StatObject

func StatObject(ctx context.Context, client *storage.Client, object string) (*storage.ObjectAttrs, error)

func ValidateObjectChunkFromGCS

func ValidateObjectChunkFromGCS(ctx context.Context, storageClient *storage.Client,
	testDirName string, fileName string, offset, size int64, expectedContent string,
	t *testing.T)

func ValidateObjectContentsFromGCS

func ValidateObjectContentsFromGCS(ctx context.Context, storageClient *storage.Client,
	testDirName string, fileName string, expectedContent string, t *testing.T)

func ValidateObjectNotFoundErrOnGCS

func ValidateObjectNotFoundErrOnGCS(ctx context.Context, storageClient *storage.Client,
	testDirName string, fileName string, t *testing.T)

func WriteToObject

func WriteToObject(ctx context.Context, client *storage.Client, object, content string, precondition storage.Conditions) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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