Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LocalObjectTypeAdded tags the local added file's tag LocalObjectTypeAdded = "added" // LocalObjectTypeChanged tags the local changed file's tag LocalObjectTypeChanged = "changed" )
Variables ¶
This section is empty.
Functions ¶
func DetectContentType ¶
DetectContentType returns the file content-type
func DriverValidate ¶
DriverValidate is a func to validate driver
Types ¶
type Driver ¶
type Driver interface {
ListObjects(prefix string) ([]Object, error)
Upload(object, rawPath string) error
Delete(object string) error
}
Driver is the interface that must be implemented by a cloud storage driver.
func NewDriver ¶
func NewDriver(driver DriverConfig) (Driver, error)
New is a instantiation function to find and init a upload driver.
func NewS3Uploader ¶
NewS3Uploader returns a new s3 uploader
type DriverConfig ¶
type DriverConfig struct {
Name string `yaml:"name"`
Region string `yaml:"region"`
Bucket string `yaml:"bucket"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
}
DriverConfig provides driver configuration for the uploader.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine provides the core logic to finish the feature
type EngineConfig ¶
type EngineConfig struct {
SaveRoot string `yaml:"save_root"`
VisitHost string `yaml:"visit_host"`
ForceSync bool `yaml:"force_sync"`
Excludes []string `yaml:"excludes"`
}
EngineConfig provides core configuration for the engine.
type Object ¶
type Object struct {
Key string // remote file path
ETag string // file md5
FilePath string // local file path
Type string // local file type, added or changed
}
Object is the basic operation unit
type S3Uploader ¶
type S3Uploader struct {
// contains filtered or unexported fields
}
S3Uploader implements the Driver base on the S3 of AWS.
func (*S3Uploader) Delete ¶
func (u *S3Uploader) Delete(object string) (err error)
Delete deletes the object
func (*S3Uploader) ListObjects ¶
func (u *S3Uploader) ListObjects(prefix string) ([]Object, error)
ListObjects returns some remote objects
func (*S3Uploader) Upload ¶
func (u *S3Uploader) Upload(objectKey, filePath string) (err error)
Upload uploads the local file to the object
Click to show internal directories.
Click to hide internal directories.