Documentation ¶
Index ¶
- type Driver
- type Interface
- type MockDriver
- func (d *MockDriver) Connect(address, accessKeyID, accessKey string) error
- func (d *MockDriver) Get(ctx context.Context, bucketName string, objectName string) (io.Reader, error)
- func (d *MockDriver) Put(ctx context.Context, bucketName string, objectName string, objectSize int64, ...) error
- func (d *MockDriver) ToggleThrowGetError()
- func (d *MockDriver) ToggleThrowPutError()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements the ObjectStore interface
func (*Driver) Get ¶
Get gets the object from the object store
ctx: context.Context, the context in which this operation takes place bucketName: string, name of the bucket this object is in objectName: string, name of the object Returns: io.Reader for the object and a possible error
func (*Driver) Put ¶
func (d *Driver) Put(ctx context.Context, bucketName string, objectName string, objectSize int64, object io.Reader) error
Put puts an object into the object store
ctx: context.Context, the context in which this operation takes place bucketName: string, the bucket to place the object into objectName: io.Reader, a reader for the object we want to place in the object store Returns a possible error
type Interface ¶
type Interface interface { Connect(address, accessKeyID, accessKey string) error Get(ctx context.Context, bucketName string, objectName string) (io.Reader, error) Put(ctx context.Context, bucketName string, objectName string, objectSize int64, object io.Reader) error }
The Interface models an object store with storage buckets
func NewDriver ¶
func NewDriver() Interface
NewDriver creates a new object store driver
Return: the interface of the new driver
func NewMockDriver ¶
func NewMockDriver() Interface
NewMockDriver creates a new mock object store driver
Return: the interface of the new mock driver
type MockDriver ¶
type MockDriver struct {
// contains filtered or unexported fields
}
MockDriver implements the ObjectStore interface (mock)
func (*MockDriver) Connect ¶
func (d *MockDriver) Connect(address, accessKeyID, accessKey string) error
Connect opens a connection to the object store (mock)
Return: an error if there is one
func (*MockDriver) Get ¶
func (d *MockDriver) Get(ctx context.Context, bucketName string, objectName string) (io.Reader, error)
Get gets an object from the object store (mock)
ctx: context.Context, the context for the mock driver bucketName: string, the name of the bucket objectName: string, the name of the object Return: (io.Reader, error) returns the reader and an error if there is one
func (*MockDriver) Put ¶
func (d *MockDriver) Put(ctx context.Context, bucketName string, objectName string, objectSize int64, object io.Reader) error
Put puts an object in the object store
ctx: context.Context, the context for the mock driver bucketName: string, the name of the bucket objectName: string, the name of the object objectSize: int64, the size of the object object: io.Reader, the reader for the mock driver Return: error if there is one
func (*MockDriver) ToggleThrowGetError ¶
func (d *MockDriver) ToggleThrowGetError()
ToggleThrowGetError makes the Get method throw an error the next time it is called
func (*MockDriver) ToggleThrowPutError ¶
func (d *MockDriver) ToggleThrowPutError()
ToggleThrowPutError makes the Put method throw an error the next time it is called