Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download(c BucketConf, path string, handler ObjectHandler) (<-chan int, <-chan error)
Download starts the downloading of a resource residing at path in the bucket given by the configuration.
Types ¶
type BucketConf ¶
type BucketConf struct {
Bucket, ID, Secret, Region string
}
BucketConf represents the data needed to access an S3 bucket. Specifically, it contains the bucket name, region, and key/secret credentials
type Downloader ¶
type Downloader interface { Download(path string, handler ObjectHandler) (<-chan int, <-chan error) DownloadObjects(path string, handler ObjectHandler, nobj, startobj int) (<-chan int, <-chan error) }
Downloader exposes two methods to download objects from an S3 bucket. Download takes as parameters a path to a resource located in the bucket, and an ObjectHandler to handle each object of the resource as it is downloaded. DownloadObjects is for testing purposes and offers a way to limit the number of objects downloaded. This can be convenient when dealing with resources containing large numbers of objects.
func NewDownloader ¶
func NewDownloader(c BucketConf) Downloader
NewDownloader creates and initializes a Downloader for the specified bucket in the specified region.
type Object ¶
type Object struct { ID int // contains filtered or unexported fields }
Object is a writable structure representing a binary blob residing on an S3 bucket. It is written as part of the process of downloading objects from S3.
type ObjectHandler ¶
type ObjectHandler interface { HandleObject(*Object) OnDone() }
ObjectHandler declares the interface needed to receive the objects downloaded by the Downloader.
type Uploader ¶
Uploader is the interface that wraps the Upload method.
func NewUploader ¶
func NewUploader(c BucketConf) Uploader
NewUploader creates and initializes a new Uploader based on the values contained in BucketConf.