Documentation ¶
Index ¶
- Variables
- type FileStorage
- func (fs *FileStorage) Create() error
- func (fs *FileStorage) Exists() (bool, error)
- func (fs *FileStorage) GetReader(key string) (io.Reader, error)
- func (fs *FileStorage) IsNotExist(err error) bool
- func (fs *FileStorage) PutReader(key string, r io.Reader) (length int, err error)
- func (fs *FileStorage) Size(key string) (int, error)
- type HeadError
- type MockReaderWrapper
- type MockRequestFault
- type MockStorage
- func (s *MockStorage) ClearReaderWrappers()
- func (s *MockStorage) ClearRequestFaults()
- func (s *MockStorage) Create() error
- func (s *MockStorage) Exists() (bool, error)
- func (s *MockStorage) GetReader(key string) (r io.Reader, err error)
- func (s *MockStorage) InjectReaderWrapper(fn MockReaderWrapper)
- func (s *MockStorage) InjectRequestFault(fn MockRequestFault)
- func (s *MockStorage) IsNotExist(err error) bool
- func (s *MockStorage) PutReader(key string, r io.Reader) (int, error)
- func (s *MockStorage) PutString(key, value string)
- func (s *MockStorage) Size(key string) (int, error)
- type S3Connection
- func (c *S3Connection) Create() error
- func (c *S3Connection) Exists() (bool, error)
- func (c *S3Connection) GetReader(key string) (io.Reader, error)
- func (c *S3Connection) IsNotExist(err error) bool
- func (c *S3Connection) PutReader(key string, r io.Reader) (length int, err error)
- func (c *S3Connection) Size(key string) (int, error)
Constants ¶
This section is empty.
Variables ¶
var MockErrNoSuchKey = errors.New("The specified key does not exist.")
Functions ¶
This section is empty.
Types ¶
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
FileStorage stores data locally on disk in some directory.
func NewFileStorage ¶
func NewFileStorage(root string) *FileStorage
func (*FileStorage) Create ¶
func (fs *FileStorage) Create() error
func (*FileStorage) Exists ¶
func (fs *FileStorage) Exists() (bool, error)
func (*FileStorage) IsNotExist ¶
func (fs *FileStorage) IsNotExist(err error) bool
type MockRequestFault ¶
type MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
MockStorage is used for testing; data is stored in memory in a map.
func NewMockStorage ¶
func NewMockStorage() *MockStorage
func (*MockStorage) ClearReaderWrappers ¶
func (s *MockStorage) ClearReaderWrappers()
ClearReaderWrappers clears any reader callbacks that have been added by InjectReaderWrapper.
func (*MockStorage) ClearRequestFaults ¶
func (s *MockStorage) ClearRequestFaults()
ClearRequestFaults clears any request callbacks that have been added by InjectRequestFault.
func (*MockStorage) Create ¶
func (s *MockStorage) Create() error
func (*MockStorage) Exists ¶
func (s *MockStorage) Exists() (bool, error)
func (*MockStorage) GetReader ¶
func (s *MockStorage) GetReader(key string) (r io.Reader, err error)
func (*MockStorage) InjectReaderWrapper ¶
func (s *MockStorage) InjectReaderWrapper(fn MockReaderWrapper)
InjectReaderWrapper adds a callback which gets called when an io.Reader is returned by GetReader. This func should wrap that Reader or return it unchanged.
func (*MockStorage) InjectRequestFault ¶
func (s *MockStorage) InjectRequestFault(fn MockRequestFault)
InjectRequestFault adds a callback which gets called when a key is requested by GetReader. This func should return an error or nil.
func (*MockStorage) IsNotExist ¶
func (s *MockStorage) IsNotExist(err error) bool
func (*MockStorage) PutString ¶
func (s *MockStorage) PutString(key, value string)
Put allows easy writing to a key for tests.
type S3Connection ¶
type S3Connection struct {
// contains filtered or unexported fields
}
S3Connection stores data remotely to a private S3 bucket.
func NewS3Connection ¶
func NewS3Connection(region, bucket, accessKey, secretKey string) (*S3Connection, error)
NewS3Connection connects to S3 in the given region, using the AWS credentials provided. If accessKey / secretKey are blank, will try to either read them from ENV[AWS_CREDENTIAL_FILE] (defaults to $HOME/.aws/credentials) or use the values in ENV[AWS_ACCESS_KEY] and ENV[AWS_SECRET_KEY].
func (*S3Connection) Create ¶
func (c *S3Connection) Create() error
func (*S3Connection) Exists ¶
func (c *S3Connection) Exists() (bool, error)
func (*S3Connection) IsNotExist ¶
func (c *S3Connection) IsNotExist(err error) bool