gcs

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gcs provides a storage implementation for GCS

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled is a flag to enable or disable the storage
	Enabled bool `json:"enabled" koanf:"enabled" default:"false"`
	// CredentialsFile is the path to the credentials file
	CredentialsFile string `json:"credentialsFile" koanf:"credentialsFile" default:"./credentials.json"`
	// Bucket is the name of the bucket
	Bucket string `json:"bucket" koanf:"bucket" default:"yourbucketname"`
}

Config is the configuration for Storage - need to blow this out but initial focus was on s3

type Storage

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

Storage is a Google Cloud Storage interface

func NewStorage

func NewStorage(ctx context.Context, credentialsFile, bucket string) (*Storage, error)

NewStorage returns a new GCP Storage with the provided configuration

func (*Storage) Delete

func (g *Storage) Delete(ctx context.Context, path string) error

Delete deletes path

func (*Storage) Open

func (g *Storage) Open(ctx context.Context, path string) (io.ReadCloser, error)

Open opens path for reading

func (*Storage) OpenWithStat

func (g *Storage) OpenWithStat(ctx context.Context, path string) (io.ReadCloser, *gostorage.Stat, error)

OpenWithStat opens path for reading with file stats

func (*Storage) Save

func (g *Storage) Save(ctx context.Context, content io.Reader, path string) (rerr error)

Save saves content to path

func (*Storage) Stat

func (g *Storage) Stat(ctx context.Context, path string) (*gostorage.Stat, error)

Stat returns path metadata

Jump to

Keyboard shortcuts

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