getter

package
v0.0.0-...-2c363c3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 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 FileFetcher

type FileFetcher interface {
	FetchFile(localPath, host, bucket, key string) (io.ReadCloser, Source, error)
}

FileFetcher allows us to get a ReadCloser, the source (remote/local), or an error when attempting to get a file from either local or remote storage

type Getter

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

Getter contains unexported fields allowing the local or remote fetching of files

func New

func New(logger *log.Logger, useRemoteFS bool, accessKey, accessSecret string) *Getter

New creates a instatialized Getter that can get files locally or remotely. useRemoteFS tells us if the service is configured to use the remote file system. accessKey and accessSecret are authentication parts for the remote file system.

func (*Getter) FetchFile

func (g *Getter) FetchFile(localPath, host, bucket, key string) (io.ReadCloser, Source, error)

FetchFile will reach out to s3 or use the local file system to retrieve an email file

type Source

type Source string

Source allows us to have a type safe return value specifying if a file was remote or local

const (
	// Local signifies we are using a local file source
	Local Source = "local"
	//Remote signifies we are using a remote file source
	Remote Source = "remote"
)

Jump to

Keyboard shortcuts

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