# HG changeset patch # User Alain Mazy # Date 1616142869 -3600 # Node ID 516b6e731bb56c67be16f53db0305f3d99fd85a7 # Parent 50d0be413c4227fd78fbee27a1e0a9fab072818c added support for ReadRange in google plugin diff -r 50d0be413c42 -r 516b6e731bb5 Google/GoogleStoragePlugin.cpp --- a/Google/GoogleStoragePlugin.cpp Wed Mar 17 16:02:53 2021 +0100 +++ b/Google/GoogleStoragePlugin.cpp Fri Mar 19 09:34:29 2021 +0100 @@ -103,7 +103,7 @@ } } - virtual void Read(char* data, size_t size) + virtual void ReadWhole(char* data, size_t size) { auto reader = client_.ReadObject(bucketName_, path_); @@ -120,6 +120,24 @@ } } + virtual void ReadRange(char* data, size_t size, size_t fromOffset) + { + auto reader = client_.ReadObject(bucketName_, path_, gcs::ReadRange(fromOffset, fromOffset + size)); + + if (!reader) + { + throw StoragePluginException("error while opening/reading file " + std::string(path_) + ": " + reader.status().message()); + } + + reader.read(data, size); + + if (!reader) + { + throw StoragePluginException("error while reading file " + std::string(path_) + ": " + reader.status().message()); + } + } + + };