db

package
v0.0.0-...-7359981 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found in database")

Functions

func AddToQueue

func AddToQueue(fileID string, providers []string, sr *types.StorageRequest) error

AddToQueue takes information about a file and creates queue items for each provider.

func Init

func Init() error

func SetComplete

func SetComplete(rowid int64, accessInfo string) error

SetComplete sets a queue item as complete (success) and stores the access information in the database. It also sets it as no longer taken.

func SetStatus

func SetStatus(rowid int64, status types.UploadStatus) error

SetStatus changes the upload status of the specific queue item. It should only be called by the worker in charge of this item.

Types

type QueueItem

type QueueItem struct {
	RowID          int64
	FileID         string
	StorageRequest *types.StorageRequest
	Provider       string
	Status         types.UploadStatus
}

func NextInQueue

func NextInQueue() (*QueueItem, error)

NextInQueue returns the next item in the database queue. It assumes the caller is going to operate on this item and eventually remove it from the queue, so it sets 'taken' to true.

'status' is not set to in-progress, the caller must do that.

If ErrNotFound is returned that means the queue is empty.

Jump to

Keyboard shortcuts

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