mirror of
https://github.com/rclone/rclone
synced 2024-12-28 21:03:45 +01:00
fs: introduces aliases for OpenWriterAtFn and OpenChunkWriterFn
This commit is contained in:
parent
0dea83a4aa
commit
b4e3332e02
@ -636,6 +636,9 @@ type OpenWriterAter interface {
|
||||
OpenWriterAt(ctx context.Context, remote string, size int64) (WriterAtCloser, error)
|
||||
}
|
||||
|
||||
// OpenWriterAtFn describes the OpenWriterAt function pointer
|
||||
type OpenWriterAtFn func(ctx context.Context, remote string, size int64) (WriterAtCloser, error)
|
||||
|
||||
type OpenChunkWriter interface {
|
||||
// OpenChunkWriter returns the chunk size and a ChunkWriter
|
||||
//
|
||||
@ -644,6 +647,9 @@ type OpenChunkWriter interface {
|
||||
OpenChunkWriter(ctx context.Context, remote string, src ObjectInfo, options ...OpenOption) (chunkSize int64, writer ChunkWriter, err error)
|
||||
}
|
||||
|
||||
// OpenChunkWriterFn describes the OpenChunkWriter function pointer
|
||||
type OpenChunkWriterFn func(ctx context.Context, remote string, src ObjectInfo, options ...OpenOption) (chunkSize int64, writer ChunkWriter, err error)
|
||||
|
||||
type ChunkWriter interface {
|
||||
// WriteChunk will write chunk number with reader bytes, where chunk number >= 0
|
||||
WriteChunk(chunkNumber int, reader io.ReadSeeker) (bytesWritten int64, err error)
|
||||
|
@ -277,7 +277,8 @@ func (w writerAtChunkWriter) Abort() error {
|
||||
return obj.Remove(w.ctx)
|
||||
}
|
||||
|
||||
func openChunkWriterFromOpenWriterAt(openWriterAt func(ctx context.Context, remote string, size int64) (fs.WriterAtCloser, error), chunkSize int64, writeBufferSize int64, f fs.Fs) func(ctx context.Context, remote string, src fs.ObjectInfo, options ...fs.OpenOption) (chunkSizeResult int64, writer fs.ChunkWriter, err error) {
|
||||
// openChunkWriterFromOpenWriterAt adapts an OpenWriterAtFn into an OpenChunkWriterFn using chunkSize and writeBufferSize
|
||||
func openChunkWriterFromOpenWriterAt(openWriterAt fs.OpenWriterAtFn, chunkSize int64, writeBufferSize int64, f fs.Fs) fs.OpenChunkWriterFn {
|
||||
return func(ctx context.Context, remote string, src fs.ObjectInfo, options ...fs.OpenOption) (chunkSizeResult int64, writer fs.ChunkWriter, err error) {
|
||||
writerAt, err := openWriterAt(ctx, remote, src.Size())
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user