objectmanager

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 10 Imported by: 0

README

NaveOSS Object Manager

ObjectManager is a Go module that uses the NaveOSS Bucket module to manage files on each of the configured Buckets.

Why

NaveOSS Bucket module was designed specifically to hide the implementation for each of the supported file storage types (s3, filesystem, sftp). Object Manager wraps thos buckets in automatic object control.

Goals
  • File name obfuscation on target disk
  • Automatic redundancy across buckets
  • Automatic balancing of object based on $/GB storage
  • Automatic balancing of object fetch based on Speed/cost
  • File searching
  • File search on offline buckets

Documentation

Index

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL