blob_fetcher.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include "rocksdb/options.h"
  7. #include "rocksdb/status.h"
  8. namespace ROCKSDB_NAMESPACE {
  9. class Version;
  10. class Slice;
  11. class FilePrefetchBuffer;
  12. class PinnableSlice;
  13. class BlobIndex;
  14. // A thin wrapper around the blob retrieval functionality of Version.
  15. class BlobFetcher {
  16. public:
  17. BlobFetcher(const Version* version, const ReadOptions& read_options)
  18. : version_(version), read_options_(read_options) {}
  19. Status FetchBlob(const Slice& user_key, const Slice& blob_index_slice,
  20. FilePrefetchBuffer* prefetch_buffer,
  21. PinnableSlice* blob_value, uint64_t* bytes_read) const;
  22. Status FetchBlob(const Slice& user_key, const BlobIndex& blob_index,
  23. FilePrefetchBuffer* prefetch_buffer,
  24. PinnableSlice* blob_value, uint64_t* bytes_read) const;
  25. private:
  26. const Version* version_;
  27. ReadOptions read_options_;
  28. };
  29. } // namespace ROCKSDB_NAMESPACE