objgcp

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package objgcp provides an implementation of 'objstore.Client' for use with GCS.

Index

Constants

View Source
const (
	// MaxComposable is the hard limit imposed by Google Storage on the maximum number of objects which can be composed
	// into one, however, note that composed objects may be used as the source for composed objects.
	MaxComposable = 32

	// ChunkSize is the size used for a "resumable" upload in the GCP SDK, required to enable request retries.
	//
	// NOTE: Use 8MiB here to reduce the likelihood of triggering resumable uploads in the multipart upload golden path
	// in 'cbbackupmgr', see MB-53720 for more information.
	ChunkSize = 8 * 1024 * 1024

	// ChunkRetryDeadline is the timeout for uploading a single chunk to GCP, this matches the timeout used in
	// 'cbbackupmgr' for the object storage HTTP client timeout.
	ChunkRetryDeadline = 30 * time.Minute
)

Variables

View Source
var RegexUploadPart = regexp.MustCompile(fmt.Sprintf(`^.*-mpu-%s-%s$`, regexUUID, regexUUID))

RegexUploadPart matches the key for an object created by the GCP client as part of emulating multipart uploads.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements the 'objcli.Client' interface allowing the creation/management of objects stored in Google Storage.

func NewClient

func NewClient(options ClientOptions) *Client

NewClient returns a new client which uses the given storage client, in general this should be the one created using the 'storage.NewClient' function exposed by the SDK.

func (*Client) AbortMultipartUpload

func (c *Client) AbortMultipartUpload(ctx context.Context, opts objcli.AbortMultipartUploadOptions) error

func (*Client) AppendToObject

func (c *Client) AppendToObject(ctx context.Context, opts objcli.AppendToObjectOptions) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) CompleteMultipartUpload

func (c *Client) CompleteMultipartUpload(ctx context.Context, opts objcli.CompleteMultipartUploadOptions) error

func (*Client) CopyObject

func (c *Client) CopyObject(ctx context.Context, opts objcli.CopyObjectOptions) error

func (*Client) CreateMultipartUpload

func (c *Client) CreateMultipartUpload(_ context.Context, _ objcli.CreateMultipartUploadOptions) (string, error)

func (*Client) DeleteDirectory

func (c *Client) DeleteDirectory(ctx context.Context, opts objcli.DeleteDirectoryOptions) error

func (*Client) DeleteObjects

func (c *Client) DeleteObjects(ctx context.Context, opts objcli.DeleteObjectsOptions) error

func (*Client) GetObject

func (c *Client) GetObject(ctx context.Context, opts objcli.GetObjectOptions) (*objval.Object, error)

func (*Client) GetObjectAttrs

func (c *Client) GetObjectAttrs(ctx context.Context, opts objcli.GetObjectAttrsOptions) (*objval.ObjectAttrs, error)

func (*Client) IterateObjects

func (c *Client) IterateObjects(ctx context.Context, opts objcli.IterateObjectsOptions) error

func (*Client) ListParts

func (c *Client) ListParts(ctx context.Context, opts objcli.ListPartsOptions) ([]objval.Part, error)

func (*Client) Provider

func (c *Client) Provider() objval.Provider

func (*Client) PutObject

func (c *Client) PutObject(ctx context.Context, opts objcli.PutObjectOptions) error

func (*Client) UploadPart

func (c *Client) UploadPart(ctx context.Context, opts objcli.UploadPartOptions) (objval.Part, error)

func (*Client) UploadPartCopy

func (c *Client) UploadPartCopy(ctx context.Context, opts objcli.UploadPartCopyOptions) (objval.Part, error)

NOTE: Google storage does not support byte range copying, therefore, only the entire object may be copied; this may be done by either not providing a byte range, or providing a byte range for the entire object.

type ClientOptions

type ClientOptions struct {
	// Client is a client for interacting with Google Cloud Storage.
	//
	// NOTE: Required
	Client *storage.Client

	// Logger is the passed logger which implements a custom Log method
	Logger *slog.Logger
}

ClientOptions encapsulates the options for creating a new GCP Client.

Jump to

Keyboard shortcuts

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