objectstore

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Name       string
	AccessKey  string
	SecretKey  string
	Endpoint   string
	Region     string
	BucketName string
	// contains filtered or unexported fields
}

Bucket for connection to a bucket in object store

func NewBucket

func NewBucket(name, accessKey, secretKey, endpoint, region, bucketName string, insecure bool) *Bucket

NewBucket returns new Bucket

func (*Bucket) ChkBucket

func (b *Bucket) ChkBucket() (bool, error)

ChkBucket checks the bucket exists

func (*Bucket) CreateBucket

func (b *Bucket) CreateBucket() error

CreateBucket creates a bucket

func (*Bucket) Delete

func (b *Bucket) Delete(filename string) error

Delete a file in the bucket

func (*Bucket) Download

func (b *Bucket) Download(file *os.File, filename string) error

Download a file from the bucket

func (*Bucket) GetBucketName

func (b *Bucket) GetBucketName() string

GetBucketName returns bucket's BacketName

func (*Bucket) GetEndpoint

func (b *Bucket) GetEndpoint() string

GetEndpoint returns bucket's Endpoint

func (*Bucket) GetName

func (b *Bucket) GetName() string

GetName returns bucket's Name

func (*Bucket) GetObjectInfo

func (b *Bucket) GetObjectInfo(filename string) (*ObjectInfo, error)

GetObjectInfo gets info of a file in the bucket

func (*Bucket) ListObjectInfo

func (b *Bucket) ListObjectInfo() ([]ObjectInfo, error)

ListObjectInfo lists object info

func (*Bucket) Upload

func (b *Bucket) Upload(file *os.File, filename string) error

Upload a file to the bucket

type ObjectInfo

type ObjectInfo struct {
	Name             string
	Size             int64
	Timestamp        time.Time
	BucketConfigName string
}

ObjectInfo retains snapshot object's info

type Objectstore

type Objectstore interface {
	ChkBucket() (bool, error)
	CreateBucket() error
	Upload(file *os.File, filename string) error
	Download(file *os.File, filename string) error
	Delete(filename string) error
	GetObjectInfo(filename string) (*ObjectInfo, error)
	ListObjectInfo() ([]ObjectInfo, error)

	GetName() string
	GetEndpoint() string
	GetBucketName() string
}

Objectstore interfaces

Jump to

Keyboard shortcuts

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