operationq

package
v0.0.0-...-08e143e Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotExist = errors.New("file is not exists")
)
View Source
var (
	ErrLackOfStorage = errors.New("cannot save the files because of lack of storage space")
)

Functions

This section is empty.

Types

type DeleteQueue

type DeleteQueue struct {
	Files []*model.File
}

func NewDelQ

func NewDelQ() *DeleteQueue

func (*DeleteQueue) Push

func (delQ *DeleteQueue) Push(googleID string, fileNames ...string) error

* Push the files to delete.

func (*DeleteQueue) Schedule

func (delQ *DeleteQueue) Schedule() map[string][]*model.ShardToDelete

* Assign shards for deletion to the each nodes which are identified by machine id.

type DownloadQueue

type DownloadQueue struct {
	Files []*model.FileToLoad
}

func NewDQ

func NewDQ() *DownloadQueue

func (*DownloadQueue) Push

func (dq *DownloadQueue) Push(googleID string, fileName string) error

* Push the list of file to load by querying database.

func (*DownloadQueue) Schedule

func (dq *DownloadQueue) Schedule() map[string][]*model.ShardToLoad

* Assign shards for download to the each nodes which are identified by machine id.

type RestoreQueue

type RestoreQueue struct {
	Shards []*model.ShardToLoad
}

func NewRQ

func NewRQ() *RestoreQueue

func (*RestoreQueue) Push

func (rq *RestoreQueue) Push(shards ...*model.ShardToLoad)

* Push the shard to queue.

func (*RestoreQueue) Schedule

func (rq *RestoreQueue) Schedule(safeRing, unsafeRing *ring.Ring) (map[*spool.ActiveNode][]*model.ShardToSave, error)

* Assign every data shards for restoring to the nodes. And update metadata and predict nodes' status by scheduling results.

This function change nodes' status. So you SHOULD use this function with the `NodesStatusLock` which is mutex for all nodes' status.

type UploadQueue

type UploadQueue struct {
	Files []*model.EncFile
}

func NewUQ

func NewUQ() *UploadQueue

func (*UploadQueue) Push

func (uq *UploadQueue) Push(file *model.EncFile)

* Push the encoded file to queue.

func (*UploadQueue) Schedule

func (uq *UploadQueue) Schedule(safeRing, unsafeRing *ring.Ring) (map[*spool.ActiveNode][]*model.ShardToSave, error)

* Assign every data shards for saving to the nodes. And update metadata and predict nodes' status by scheduling results.

This function change nodes' status. So you SHOULD use this function with the `NodesStatusLock` which is mutex for all nodes' status.

Jump to

Keyboard shortcuts

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