blobs

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxRandomNumber represents the random number range [0, MaxRandomNumber).
	MaxRandomNumber int = 10000

	// MetaDataDB represents the name of the file used for storing metadata.
	MetaDataDB string = "data.db"

	// CfgDataPathKey represents the dataPath key in config.
	CfgDataPathKey = "dataPath"
)

Variables

View Source
var (
	// ErrOperateDB is returned when unknow error hanppend from database.
	ErrOperateDB = errors.New("error happened when operating database")

	// ErrNotFound represents no record found.
	ErrNotFound = errors.New("not found")
)
View Source
var (
	// ErrGroupUnmatch is returned when add a Blob into a blobgroup which it is unmatch.
	ErrGroupUnmatch = errors.New("group is unmatch")
)

Functions

This section is empty.

Types

type Blob

type Blob struct {
	// FileName represents the file name of the deleted file.
	FileName string

	// Dir represent where the blob stored before deleted.
	Dir string

	// CreatedAt represents when the blob is created, i.e. when it is deleted.
	CreatedAt time.Time

	// ID used to indentify blob when two or more files has the same filename.
	ID string
}

Blob represents the blob instance.

func Create

func Create(fullPath string) *Blob

Create makes a blob metadate.

func GetAll

func GetAll() ([]*Blob, error)

GetAll returns all the blobs in database.

func (*Blob) Destroy

func (b *Blob) Destroy() error

Destroy deletes a blob from database. Only Filename and ID are compared.

func (*Blob) Name

func (b *Blob) Name() string

Name gets the name of the blob.

func (*Blob) Save

func (b *Blob) Save() error

Save stores the blob metadata to disk.

Jump to

Keyboard shortcuts

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