Documentation ¶
Index ¶
- Variables
- type BucketConfig
- type BucketInstance
- type Object
- type ObjectManager
- func (om *ObjectManager) AddBucket(b BucketConfig) error
- func (om *ObjectManager) AddObject(o *Object, r io.Reader) error
- func (om *ObjectManager) BucketConfigs() ([]BucketConfig, error)
- func (om *ObjectManager) Object(key string) (io.ReadCloser, error)
- func (om *ObjectManager) RemoveBucket(name string) error
- func (om *ObjectManager) RemoveObject(k string) error
- func (om *ObjectManager) SetDebugLog(b bool)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBucketNotFound = errors.New("Bucket Not Found") ErrObjectNotFound = errors.New("Object NoT Found") ErrUpdateRequired = errors.New("DB Update Required") ObjVersion = 1 )
View Source
var (
ErrorDanglingRelationships = errors.New("Removal would result in dangling relationships")
)
Functions ¶
This section is empty.
Types ¶
type BucketConfig ¶
type BucketConfig struct { // Name is the assigned name to the bucket Name string `json:"name"` // DSN is the connection string to initialize a Bucket DSN string `json:"dsn"` // Auth is the auth details used to initialize a bucket Auth string `json:"auth"` // Cost is the per GB/year cost of storing an object in this bucket Transient bool `json:"transient"` Local bool `json:"local"` BytesUsed int64 `json:"bytes_used"` BytesQuota int64 `json:"bytes_quota"` DateCreated time.Time `json:"date_created"` DateModified time.Time `json:"date_modified"` }
BucketConfig is the stored details of a bucket that can be used to initialize a Bucket object
type BucketInstance ¶
type BucketInstance struct { Config BucketConfig Bucket bucket.Bucket }
type Object ¶
type Object struct { // Key is the db identifier which may be different than the key used to store the object Key string // BucketKey contains the name of the key used to store the object in the Bucket BucketKey string Transient bool // Object can be stored on Transient storage LocalOnly bool // Can objects be stored in the cloud DateCreated time.Time `json:"date_created"` DateModified time.Time `json:"date_modified"` }
type ObjectManager ¶ added in v0.0.3
type ObjectManager struct {
// contains filtered or unexported fields
}
func NewObjectManager ¶ added in v0.0.3
func NewObjectManager(driver string, dsn string, init bool) (*ObjectManager, error)
NewStorageManager will read the database for BucketConfig rows and automatically initialize all of the the available buckets. Returns error if any of these buckets fail to initialize or if reading the configs from the db fails.
func (*ObjectManager) AddBucket ¶ added in v0.0.3
func (om *ObjectManager) AddBucket(b BucketConfig) error
addBucket creates the bucket.Bucket object to test that the bucket is valid and then stores the config in the database.
func (*ObjectManager) AddObject ¶ added in v0.0.3
func (om *ObjectManager) AddObject(o *Object, r io.Reader) error
func (*ObjectManager) BucketConfigs ¶ added in v0.0.3
func (om *ObjectManager) BucketConfigs() ([]BucketConfig, error)
func (*ObjectManager) Object ¶ added in v1.0.2
func (om *ObjectManager) Object(key string) (io.ReadCloser, error)
func (*ObjectManager) RemoveBucket ¶ added in v0.0.3
func (om *ObjectManager) RemoveBucket(name string) error
func (*ObjectManager) RemoveObject ¶ added in v0.0.3
func (om *ObjectManager) RemoveObject(k string) error
func (*ObjectManager) SetDebugLog ¶ added in v1.0.1
func (om *ObjectManager) SetDebugLog(b bool)
Click to show internal directories.
Click to hide internal directories.