/src/rocksdb/db/blob/blob_read_request.h
Line | Count | Source |
1 | | // Copyright (c) Meta Platforms, Inc. and affiliates. |
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 | | |
6 | | #pragma once |
7 | | |
8 | | #include <cinttypes> |
9 | | |
10 | | #include "rocksdb/compression_type.h" |
11 | | #include "rocksdb/slice.h" |
12 | | #include "rocksdb/status.h" |
13 | | #include "util/autovector.h" |
14 | | |
15 | | namespace ROCKSDB_NAMESPACE { |
16 | | |
17 | | // A read Blob request structure for use in BlobSource::MultiGetBlob and |
18 | | // BlobFileReader::MultiGetBlob. |
19 | | struct BlobReadRequest { |
20 | | // User key to lookup the paired blob |
21 | | const Slice* user_key = nullptr; |
22 | | |
23 | | // File offset in bytes |
24 | | uint64_t offset = 0; |
25 | | |
26 | | // Length to read in bytes |
27 | | size_t len = 0; |
28 | | |
29 | | // Blob compression type |
30 | | CompressionType compression = kNoCompression; |
31 | | |
32 | | // Output parameter set by MultiGetBlob() to point to the data buffer, and |
33 | | // the number of valid bytes |
34 | | PinnableSlice* result = nullptr; |
35 | | |
36 | | // Status of read |
37 | | Status* status = nullptr; |
38 | | |
39 | | BlobReadRequest(const Slice& _user_key, uint64_t _offset, size_t _len, |
40 | | CompressionType _compression, PinnableSlice* _result, |
41 | | Status* _status) |
42 | 0 | : user_key(&_user_key), |
43 | 0 | offset(_offset), |
44 | 0 | len(_len), |
45 | 0 | compression(_compression), |
46 | 0 | result(_result), |
47 | 0 | status(_status) {} |
48 | | |
49 | 0 | BlobReadRequest() = default; |
50 | | BlobReadRequest(const BlobReadRequest& other) = default; |
51 | | BlobReadRequest& operator=(const BlobReadRequest& other) = default; |
52 | | }; |
53 | | |
54 | | using BlobFileReadRequests = |
55 | | std::tuple<uint64_t /* file_number */, uint64_t /* file_size */, |
56 | | autovector<BlobReadRequest>>; |
57 | | |
58 | | } // namespace ROCKSDB_NAMESPACE |