1
0
Fork 0
mirror of https://github.com/Luzifer/cloudbox.git synced 2024-12-23 03:01:18 +00:00
cloudbox/providers/interface.go

36 lines
738 B
Go
Raw Normal View History

2019-06-16 00:05:06 +00:00
package providers
import (
2019-06-16 16:53:30 +00:00
"hash"
2019-06-16 00:05:06 +00:00
"github.com/pkg/errors"
)
type Capability uint8
const (
CapBasic Capability = 1 << iota
CapShare
CapAutoChecksum
)
2019-06-16 16:53:30 +00:00
func (c Capability) Has(test Capability) bool { return c&test != 0 }
2019-06-16 00:05:06 +00:00
var (
ErrInvalidURI = errors.New("Spefified URI is invalid for this provider")
ErrFeatureNotSupported = errors.New("Feature not supported")
)
type CloudProviderInitFunc func(string) (CloudProvider, error)
type CloudProvider interface {
Capabilities() Capability
DeleteFile(relativeName string) error
2019-06-16 16:53:30 +00:00
GetChecksumMethod() hash.Hash
2019-06-16 00:05:06 +00:00
GetFile(relativeName string) (File, error)
ListFiles() ([]File, error)
2019-06-16 16:53:30 +00:00
Name() string
PutFile(File) (File, error)
2019-06-16 00:05:06 +00:00
Share(relativeName string) (string, error)
}