gcs

package
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

An implementation of Client that delegates actual operation to gcsStorage.Client.

func (Adapter) Read

func (a Adapter) Read(ctx context.Context) ([]byte, error)

func (Adapter) Write

func (a Adapter) Write(ctx context.Context, p []byte) error

type Client

type Client interface {
	// Read an object from a GCS bucket.
	Read(ctx context.Context) ([]byte, error)

	// Write an object onto a GCS bucket.
	Write(ctx context.Context, p []byte) error
}

A minimal interface to mock behavior of GCS client.

func NewClient

func NewClient(ctx context.Context, config Config) (Client, error)

NewClient returns a new Client with given Context and Config.

type Config

type Config struct {
	// The name of the GCS bucket.
	Bucket string `hcl:"bucket"`
	// Path to the migration history file.
	Name string `hcl:"name"`
}

Config is a config for Google Cloud Storage. This is expected to have almost the same options as Terraform gcs backend. https://www.terraform.io/language/settings/backends/gcs However, it has many minor options and it's a pain to test all options from first, so we added only options we need for now.

func (*Config) NewStorage

func (c *Config) NewStorage() (storage.Storage, error)

NewStorage returns a new instance of storage.Storage.

type Storage

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

An implementation of storage.Storage interface.

func NewStorage

func NewStorage(config *Config, client Client) (*Storage, error)

NewStorage returns a new instance of Storage.

func (*Storage) Read

func (s *Storage) Read(ctx context.Context) ([]byte, error)

func (*Storage) Write

func (s *Storage) Write(ctx context.Context, b []byte) error

Jump to

Keyboard shortcuts

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