Documentation ¶
Overview ¶
Package transfer provides primitives for uploading and downloading datasets
Index ¶
- type Archiver
- type DiscardReporter
- func (r *DiscardReporter) HandledKey(key string)
- func (r *DiscardReporter) StartArchivingProgress(label string, total int64) func(int64)
- func (r *DiscardReporter) StartDownloadProgress(label string, total int64) io.Writer
- func (r *DiscardReporter) StartUnarchivingProgress(label string, total int64, rr io.Reader) io.Reader
- func (r *DiscardReporter) StartUploadProgress(label string, total int64, rr io.Reader) io.Reader
- func (r *DiscardReporter) StopArchivingProgress()
- func (r *DiscardReporter) StopDownloadProgress()
- func (r *DiscardReporter) StopUnarchivingProgress()
- func (r *DiscardReporter) StopUploadProgress()
- type Handle
- type HandleDelegate
- type KubeManager
- func (mgr *KubeManager) Create(ctx context.Context, name string, sto transferstore.StoreOptions, ...) (h Handle, err error)
- func (mgr *KubeManager) Info(ctx context.Context, name string) (size uint64, err error)
- func (mgr *KubeManager) Open(ctx context.Context, name string) (Handle, error)
- func (mgr *KubeManager) Remove(ctx context.Context, name string) error
- type Manager
- type Reporter
- type StdHandle
- func (h *StdHandle) Clear(ctx context.Context, reporter Reporter) (err error)
- func (h *StdHandle) Close() (err error)
- func (h *StdHandle) Name() string
- func (h *StdHandle) Pull(ctx context.Context, toPath string, rep Reporter) (err error)
- func (h *StdHandle) Push(ctx context.Context, fromPath string, rep Reporter) (err error)
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archiver ¶
type Archiver interface { Index(fn func(k string) error) error Archive(ctx context.Context, path string, rep transferarchiver.Reporter, fn func(k string, r io.ReadSeeker, nbytes int64) error) error Unarchive(ctx context.Context, path string, rep transferarchiver.Reporter, fn func(k string, w io.WriterAt) error) error }
Archiver allows archiving a directory
func CreateArchiver ¶
CreateArchiver will creates one of the standard storews with the provided options
type DiscardReporter ¶
type DiscardReporter struct{}
DiscardReporter is a reporter that discards
func NewDiscardReporter ¶
func NewDiscardReporter() *DiscardReporter
NewDiscardReporter discards all progress reports
func (*DiscardReporter) HandledKey ¶
func (r *DiscardReporter) HandledKey(key string)
HandledKey discards the information a key was handled
func (*DiscardReporter) StartArchivingProgress ¶
func (r *DiscardReporter) StartArchivingProgress(label string, total int64) func(int64)
StartArchivingProgress is called when archiving has started and total size is known
func (*DiscardReporter) StartDownloadProgress ¶
func (r *DiscardReporter) StartDownloadProgress(label string, total int64) io.Writer
StartDownloadProgress will start the download progress
func (*DiscardReporter) StartUnarchivingProgress ¶
func (*DiscardReporter) StartUploadProgress ¶
StartUploadProgress is called when upload has started while total size is known
func (*DiscardReporter) StopArchivingProgress ¶
func (r *DiscardReporter) StopArchivingProgress()
StopArchivingProgress is called when archiving has stoppped
func (*DiscardReporter) StopDownloadProgress ¶
func (r *DiscardReporter) StopDownloadProgress()
StopDownloadProgress will stop the download progress
func (*DiscardReporter) StopUnarchivingProgress ¶
func (r *DiscardReporter) StopUnarchivingProgress()
func (*DiscardReporter) StopUploadProgress ¶
func (r *DiscardReporter) StopUploadProgress()
StopUploadProgress is called when uploading has stopped
type Handle ¶
type Handle interface { io.Closer Name() string Clear(ctx context.Context, reporter Reporter) error Push(ctx context.Context, fromPath string, rep Reporter) error Pull(ctx context.Context, toPath string, rep Reporter) error }
A Handle provides interactions with a dataset
type HandleDelegate ¶
type HandleDelegate interface { PostClean(ctx context.Context) error //eg, set size to PostPush(ctx context.Context, size uint64) error //eg, set new size PostPull(ctx context.Context) error PostClose() error //eg release the lock }
HandleDelegate allows customization of lifecycle events, these events can be handled inside the lock of the handle
type KubeManager ¶
type KubeManager struct {
// contains filtered or unexported fields
}
KubeManager is a dataset manager that uses Kubernetes as its metadata store and locking service
func NewKubeManager ¶
func NewKubeManager(kube *svc.Kube) (mgr *KubeManager, err error)
NewKubeManager creates a transferManager that uses our kubevisor implementation
func (*KubeManager) Create ¶
func (mgr *KubeManager) Create(ctx context.Context, name string, sto transferstore.StoreOptions, ato transferarchiver.ArchiverOptions) (h Handle, err error)
Create a dataset with provided name and return a handle to it, dataset must not yet exist
type Manager ¶
type Manager interface { Create(ctx context.Context, name string, sti transferstore.StoreOptions, sto transferarchiver.ArchiverOptions) (Handle, error) //must not exist, name is unique, claims dataset handle Open(ctx context.Context, name string) (Handle, error) //must exist, claims dataset handle Remove(ctx context.Context, name string) error Info(ctx context.Context, name string) (size uint64, err error) }
Manager provides access to Transfer handles, this allows parallel access to datasets from multiple clients
type Reporter ¶
type Reporter interface { transferarchiver.Reporter HandledKey(key string) StartUploadProgress(label string, total int64, rr io.Reader) io.Reader StopUploadProgress() StartDownloadProgress(label string, total int64) io.Writer StopDownloadProgress() }
Reporter handles progress reporting
type StdHandle ¶
type StdHandle struct {
// contains filtered or unexported fields
}
StdHandle provides a standard implementation for handling datasets
func CreateStdHandle ¶
CreateStdHandle sets up a standard implementation of the handle
type Store ¶
type Store interface { Head(ctx context.Context, k string) (size int64, err error) Get(ctx context.Context, key string, w io.WriterAt) error Put(ctx context.Context, key string, r io.ReadSeeker) error Del(ctx context.Context, key string) error }
Store provides an object storage interface
func CreateStore ¶
CreateStore will creates of the standard stores based on the store options