fs: introduces aliases for OpenWriterAtFn and OpenChunkWriterFn

This commit is contained in:
Nick Craig-Wood
2023-08-14 18:04:42 +01:00
parent 0dea83a4aa
commit b4e3332e02
2 changed files with 8 additions and 1 deletions

View File

@ -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 {