dfs_copier_batch

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLocalToDropboxBatch

func NewLocalToDropboxBatch(ctl app_control.Control, ctx dbx_context.Context, batchSize int) es_filesystem.Connector

func StartBatchSessions

func StartBatchSessions(qd eq_queue.Definition, ctx dbx_context.Context, batchSize int) (BatchSessions, BlockSession)

Types

type BatchSessions

type BatchSessions interface {
	// NewSession Start a new session with the commit information.
	// The operation might blocked depends on the backlog size.
	NewSession(commit CommitInfo, callback SessionCallback) (sessionId string, err error)

	// AbortSession Abort uploading session for the session Id.
	// The sessionId will be removed from the batch.
	// The func callbacks OnFailure event.
	AbortSession(sessionId string, err error)

	// FinishBlockUploads Report finish for all block uploads.
	// The func should not block the operation.
	FinishBlockUploads(sessionId string)

	// Shutdown Flush and finish all sessions.
	// The operation might blocked when the backlog exists.
	Shutdown() (err dbx_error.DropboxError)

	// FinishBatchCommit Process upload session commit.
	FinishBatchCommit(batch *FinishBatch)

	// FinishBatchEntry Entry upload session commit batch.
	FinishBatchEntry(count int)
}

type BlockSession

type BlockSession interface {
	// AddBlock Add block
	AddBlock(sessionId string, offset int64)

	// FinishSuccess Tell finish operation
	FinishSuccess(sessionId string, offset int64)

	// FinishFailure Tell failure
	FinishFailure(sessionId string, err error)
}

func NewBlockSession

func NewBlockSession(ctx dbx_context.Context, bs BatchSessions) BlockSession

type CommitInfo

type CommitInfo struct {
	Path           string `json:"path"`
	Mode           string `json:"mode"`
	Autorename     bool   `json:"autorename"`
	ClientModified string `json:"client_modified"`
	Mute           bool   `json:"mute"`
	StrictConflict bool   `json:"strict_conflict"`
}

type CopyBatchUploadBlock

type CopyBatchUploadBlock struct {
	SessionId string `json:"session_id"`
	Path      string `json:"path"`
	Offset    int64  `json:"offset"`
}

type FinishBatch

type FinishBatch struct {
	Batch []string `json:"batch"`
}

type SessionCallback

type SessionCallback struct {
	CopyPair  es_filesystem.CopyPair
	OnSuccess func(pair es_filesystem.CopyPair, copied es_filesystem.Entry)
	OnFailure func(pair es_filesystem.CopyPair, err es_filesystem.FileSystemError)
}

type SessionCheck

type SessionCheck struct {
	SessionId string `json:"session_id"`
	Path      string `json:"path"`
}

type SessionId

type SessionId struct {
	SessionId string `json:"session_id" path:"session_id"`
}

type UploadAppend

type UploadAppend struct {
	Cursor UploadCursor `json:"cursor"`
	Close  bool         `json:"close"`
}

type UploadCursor

type UploadCursor struct {
	SessionId string `json:"session_id" path:"session_id"`
	Offset    int64  `json:"offset" path:"offset"`
}

type UploadFinish

type UploadFinish struct {
	Cursor UploadCursor `json:"cursor"`
	Commit CommitInfo   `json:"commit"`
}

type UploadFinishBatch

type UploadFinishBatch struct {
	Entries []UploadFinish `json:"entries"`
}

Jump to

Keyboard shortcuts

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