Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrFileNotExist = errors.New("file is not exists")
)
var (
ErrLackOfStorage = errors.New("cannot save the files because of lack of storage space")
)
Functions ¶
This section is empty.
Types ¶
type DeleteQueue ¶
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 ¶
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.