filesystem

package
v0.0.0-...-e59334c Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configurable

type Configurable interface {
	// Validate validates the configuration for a given channel
	Validate() error

	// Name returns the configuration name
	Name() string
}

Configurable represents the contract to be implemented in order to comply with setting the configurations for the different notification channels

type GCS

type GCS struct {
	Bucket              string
	Context             context.Context
	CredentialsFilePath string
	Directory           string
}

GCS represents the configuration for the Google Cloud Storage filesystem

func (*GCS) Name

func (g *GCS) Name() string

Name implementation of the Configurable interface

func (*GCS) Validate

func (g *GCS) Validate() error

Validate implementation of the Configurable interface

type Local

type Local struct {
	Path string
}

Local represents the configuration for the local filesystem

func (*Local) Name

func (l *Local) Name() string

Name implementation of the Configurable interface

func (*Local) Validate

func (l *Local) Validate() error

Validate implementation of the Configurable interface

type Storeable

type Storeable interface {
	// Init initializes the store with the proper configs
	Init(config Configurable) (Storeable, error)

	// Put stores a file with the specified name
	Put(name string, reader io.Reader) error

	// Stream streams data into a file
	Stream() error

	// OpenStream initializes the stream
	OpenStream(name string) error

	// Channel returns the stream channel
	Channel(data string)

	// Close releases the streaming resources
	Close() error

	// List lists all the file/directory names in a directory
	List(name string) ([]string, error)

	// Open retrieves a file
	Open(name string) (io.Reader, error)
}

Storeable represents the contract to be implemented by different filesystems in order to store, retrieve, stream and delete files.

func Build

func Build(config Configurable) (Storeable, error)

Build returns a filesystem implementation based on the passed in configuration

Jump to

Keyboard shortcuts

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