gcsutil

package
v0.0.0-...-cfd7a7c Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Convenience functions for working with types from package gcs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRC32C

func CRC32C(contents []byte) *uint32

Return a value appropriate for placing in CreateObjectRequest.CRC32C for the given object contents.

func CreateEmptyObjects

func CreateEmptyObjects(
	ctx context.Context,
	bucket gcs.Bucket,
	names []string) (err error)

Create empty objects with default attributes for all of the supplied names.

func CreateObject

func CreateObject(
	ctx context.Context,
	bucket gcs.Bucket,
	name string,
	contents []byte) (*gcs.Object, error)

Create an object with the supplied contents in the given bucket with the given name.

func CreateObjects

func CreateObjects(
	ctx context.Context,
	bucket gcs.Bucket,
	input map[string][]byte) (err error)

Create multiple objects with some parallelism, with contents according to the supplied map from name to contents.

func DeleteAllObjects

func DeleteAllObjects(
	ctx context.Context,
	bucket gcs.Bucket) error

Delete all objects from the supplied bucket. Results are undefined if the bucket is being concurrently updated.

func ListAll

func ListAll(
	ctx context.Context,
	bucket gcs.Bucket,
	req *gcs.ListObjectsRequest) (
	objects []*gcs.Object,
	runs []string,
	err error)

Repeatedly call bucket.ListObjects until there is nothing further to list, returning all objects and collapsed runs encountered.

May modify *req.

func ListPrefix

func ListPrefix(
	ctx context.Context,
	bucket gcs.Bucket,
	prefix string,
	objects chan<- *gcs.Object) (err error)

List objects in the supplied bucket whose name starts with the given prefix. Write them into the supplied channel in an undefined order.

func MD5

func MD5(contents []byte) *[md5.Size]byte

Return a value appropriate for placing in CreateObjectRequest.MD5 for the given object contents.

func ReadObject

func ReadObject(
	ctx context.Context,
	bucket gcs.Bucket,
	name string) (contents []byte, err error)

Read the contents of the latest generation of the object with the supplied name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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