status

package
v2.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Null        = Status{"", -1}
	Indexed     = Status{"indexed", 0}
	Retrying    = Status{"retrying", 0}
	Queued      = Status{"queued", 1}
	Downloading = Status{"downloading", 2}
	Uploading   = Status{"uploading", 2}
	Skipped     = Status{"skipped", 3}
	Ignored     = Status{"ignored", 3}
	Complete    = Status{"complete", 4}
	Canceled    = Status{"canceled", 5}
	Errored     = Status{"errored", 5}

	Included = []Status{Indexed, Queued, Retrying, Downloading, Uploading, Complete, Canceled, Errored}
	Excluded = []Status{Skipped, Ignored}
	Valid    = []Status{Indexed, Queued, Retrying, Downloading, Uploading, Complete}
	Invalid  = []Status{Null, Canceled, Errored, Skipped, Ignored}
	Running  = []Status{Downloading, Uploading}
	Ended    = []Status{Complete, Canceled, Errored}
)

Functions

This section is empty.

Types

type EventsReporter

type EventsReporter map[Status]Reporter

type File

type File struct {
	filesSDK.File
	*Job
	Status
	TransferBytes int64
	LocalPath     string
	RemotePath    string
	Id            string
	LastByte      time.Time
	Err           error
}

func (*File) SetStatus

func (f *File) SetStatus(status Status, err error)

func (*File) ToStatusFile

func (f *File) ToStatusFile() File

type Job

type Job struct {
	Id        string
	StartTime time.Time
	EndTime   time.Time
	Statuses  []ToStatusFile
	Scanning  bool
	Direction direction.Type

	LocalPath  string
	RemotePath string
	Sync       bool
	Start      func()
	Stopped    bool
	context.CancelFunc
	Wait   func()
	Params interface{}
	Client interface{}
	EventsReporter
	directory.Type
	*manager.Manager
	RetryPolicy string
	*ignore.GitIgnore
	// contains filtered or unexported fields
}

func (*Job) Add

func (r *Job) Add(report ToStatusFile)

func (*Job) All

func (r *Job) All(t ...Status) bool

func (*Job) Any

func (r *Job) Any(t ...Status) (b bool)

func (*Job) ClearStatuses

func (r *Job) ClearStatuses() Job

func (*Job) Count

func (r *Job) Count(t ...Status) int

func (*Job) ETA

func (r *Job) ETA(t ...Status) time.Duration

func (*Job) ElapsedTime

func (r *Job) ElapsedTime() time.Duration

func (*Job) Events

func (r *Job) Events(event Status, callback Reporter)

func (*Job) Files

func (r *Job) Files() []filesSDK.File

func (*Job) Find

func (r *Job) Find(t Status) (ToStatusFile, bool)

func (*Job) Idle

func (r *Job) Idle(t ...Status) bool

func (Job) Init

func (r Job) Init() *Job

func (*Job) Job

func (r *Job) Job() *Job

func (*Job) Percentage

func (r *Job) Percentage(t ...Status) int

func (*Job) RemainingBytes

func (r *Job) RemainingBytes(t ...Status) int64

func (*Job) Reset

func (r *Job) Reset()

func (*Job) SetEventsReporter

func (r *Job) SetEventsReporter(e EventsReporter)

func (*Job) SetManager

func (r *Job) SetManager(m *manager.Manager)

func (*Job) StatusFromError

func (r *Job) StatusFromError(s ToStatusFile, err error)

func (*Job) Stop

func (r *Job) Stop()

func (*Job) Sub

func (r *Job) Sub(t ...Status) *Job

func (*Job) TotalBytes

func (r *Job) TotalBytes(t ...Status) int64

func (*Job) TransferBytes

func (r *Job) TransferBytes(t ...Status) int64

func (*Job) TransferRate

func (r *Job) TransferRate(t ...Status) int64

func (*Job) UpdateStatus

func (r *Job) UpdateStatus(status Status, file ToStatusFile, err error)

func (*Job) WithContext

func (r *Job) WithContext(ctx context.Context) context.Context

type Reporter

type Reporter func(File)

type Status

type Status struct {
	Name  string
	Value int
}

func SetStatus

func SetStatus(old Status, new Status, err error) (Status, bool)

func (Status) Any

func (e Status) Any(statuses ...Status) bool

func (Status) Has

func (e Status) Has(statuses ...Status) bool

func (Status) Is

func (e Status) Is(statuses ...Status) bool

func (Status) IsNot

func (e Status) IsNot(statuses ...Status) bool

func (Status) String

func (e Status) String() string

type ToStatusFile

type ToStatusFile interface {
	ToStatusFile() File
	SetStatus(Status, error)
}

Jump to

Keyboard shortcuts

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