2020-03-06 16:39:33 +00:00
|
|
|
package objectStorage
|
|
|
|
|
2020-05-27 22:57:42 +00:00
|
|
|
import (
|
2020-09-20 05:53:01 +00:00
|
|
|
"time"
|
2020-05-27 22:57:42 +00:00
|
|
|
|
2020-09-20 05:53:01 +00:00
|
|
|
"git.sequentialread.com/forest/rootsystem/configuration"
|
2020-05-27 22:57:42 +00:00
|
|
|
)
|
2020-03-06 16:39:33 +00:00
|
|
|
|
|
|
|
type ObjectStoragerMeta struct {
|
2020-09-20 05:53:01 +00:00
|
|
|
Client ObjectStorager
|
|
|
|
Initializing bool
|
|
|
|
Description string
|
|
|
|
Err error
|
2020-03-06 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ObjectStorageFileInfo struct {
|
2020-09-20 05:53:01 +00:00
|
|
|
Name string
|
|
|
|
LastModified time.Time
|
|
|
|
IsDirectory bool
|
2020-03-06 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ObjectStorageFile struct {
|
2020-09-20 05:53:01 +00:00
|
|
|
Name string
|
|
|
|
LastModified time.Time
|
|
|
|
Content []byte
|
2020-03-06 16:39:33 +00:00
|
|
|
}
|
|
|
|
|
2020-05-27 22:57:42 +00:00
|
|
|
type ObjectStorageKey struct {
|
2020-09-20 05:53:01 +00:00
|
|
|
Name string
|
|
|
|
PathPrefix string
|
|
|
|
Read bool
|
|
|
|
Write bool
|
|
|
|
Delete bool
|
|
|
|
List bool
|
2020-05-27 22:57:42 +00:00
|
|
|
}
|
|
|
|
|
2020-03-06 16:39:33 +00:00
|
|
|
type ObjectStorager interface {
|
2020-09-20 05:53:01 +00:00
|
|
|
CreateIfNotExists() error
|
|
|
|
CreateAccessKeyIfNotExists(key ObjectStorageKey) ([]configuration.Credential, error)
|
|
|
|
List(key string) ([]ObjectStorageFileInfo, error)
|
|
|
|
Get(key string) (file ObjectStorageFile, notFound bool, err error)
|
|
|
|
Put(key string, value []byte) error
|
|
|
|
Delete(key string) error
|
2020-03-06 16:39:33 +00:00
|
|
|
}
|