Documentation ¶
Index ¶
- Constants
- Variables
- func Cache[K comparable, V any](f func(in K) V) func(in K) V
- func NewReportGetter() (EventHandler, ReportGetter)
- type Copyer
- type DeviceOption
- type Error
- type Event
- type EventFinished
- type EventHandler
- type EventReportError
- type EventUpdateCount
- type EventUpdateJob
- type EventUpdateProgress
- type Job
- type Option
- func AccurateJob(src string, dsts []string) Option
- func Overwrite(b bool) Option
- func SetFromDevice(opts ...DeviceOption) Option
- func SetToDevice(opts ...DeviceOption) Option
- func WildcardJob(opts ...WildcardJobOption) Option
- func WithEventHandler(h EventHandler) Option
- func WithHash(b bool) Option
- func WithLogger(logger *logrus.Logger) Option
- func WithProgressBar() Option
- type Report
- type ReportGetter
- type WildcardJobOption
Constants ¶
View Source
const ( JobStatusPending = "pending" JobStatusPreparing = "preparing" JobStatusCopying = "copying" JobStatusFinishing = "finishing" JobStatusFinished = "finished" )
View Source
const (
UnexpectFileMode = os.ModeType &^ os.ModeDir
)
Variables ¶
View Source
var ( ErrTargetNoSpace = fmt.Errorf("acp: target have no space") ErrTargetDropToReadonly = fmt.Errorf("acp: target droped into readonly") )
Functions ¶
func Cache ¶
func Cache[K comparable, V any](f func(in K) V) func(in K) V
func NewReportGetter ¶
func NewReportGetter() (EventHandler, ReportGetter)
Types ¶
type DeviceOption ¶
type DeviceOption func(*deviceOption) *deviceOption
func DeviceThreads ¶
func DeviceThreads(threads int) DeviceOption
func LinearDevice ¶
func LinearDevice(b bool) DeviceOption
type Error ¶
type Error struct { Src string `json:"src,omitempty"` Dst string `json:"dst,omitempty"` Err error `json:"error,omitempty"` }
func (*Error) MarshalJSON ¶
func (*Error) UnmarshalJSON ¶
type EventFinished ¶
type EventFinished struct{}
type EventHandler ¶
type EventHandler func(Event)
func NewProgressBar ¶
func NewProgressBar() EventHandler
type EventReportError ¶
type EventReportError struct {
Error *Error
}
type EventUpdateCount ¶
type EventUpdateJob ¶
type EventUpdateJob struct {
Job *Job
}
type EventUpdateProgress ¶
type Job ¶
type Job struct { Base string `json:"base"` Path []string `json:"path"` Status string `json:"status"` SuccessTargets []string `json:"success_target,omitempty"` FailTargets map[string]error `json:"fail_target,omitempty"` Size int64 `json:"size"` Mode fs.FileMode `json:"mode"` ModTime time.Time `json:"mod_time"` WriteTime time.Time `json:"write_time"` SHA256 string `json:"sha256"` }
type Option ¶
type Option func(*option) *option
func AccurateJob ¶
func SetFromDevice ¶
func SetFromDevice(opts ...DeviceOption) Option
func SetToDevice ¶
func SetToDevice(opts ...DeviceOption) Option
func WildcardJob ¶
func WildcardJob(opts ...WildcardJobOption) Option
func WithEventHandler ¶
func WithEventHandler(h EventHandler) Option
func WithLogger ¶
func WithProgressBar ¶
func WithProgressBar() Option
type Report ¶
type Report struct { Jobs []*Job `json:"files,omitempty"` Errors []*Error `json:"errors,omitempty"` }
func (*Report) ToJSONString ¶
type ReportGetter ¶
type ReportGetter func() *Report
type WildcardJobOption ¶
type WildcardJobOption func(*wildcardJob) *wildcardJob
func AccurateSource ¶
func AccurateSource(base string, paths ...[]string) WildcardJobOption
func Source ¶
func Source(paths ...string) WildcardJobOption
func Target ¶
func Target(paths ...string) WildcardJobOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.