Skip to content

Commit

Permalink
Add comment about how fs_scratch is protecting us
Browse files Browse the repository at this point in the history
  • Loading branch information
archang19 committed Jan 30, 2025
1 parent 416b65a commit 6aa94a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/rocksdb/file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,11 +867,16 @@ struct FSReadRequest {
// 2. Take ownership of the object managed by fs_scratch.
// 3. Handle invoking the custom deleter function from the FSAllocationPtr.
//
// WARNING: Do NOT assume that fs_scratch points to the start of the actual
// WARNING 1: Do NOT assume that fs_scratch points to the start of the actual
// char* data returned by the read. As the type signature suggests, fs_scratch
// is a pointer to any arbitrary data type. Use result.data() to get a valid
// start to the real data. See https://github.com/facebook/rocksdb/pull/13189
// for more context.
//
// WARNING 2: Since fs_scratch is a unique pointer, FSReadRequest's copy
// constructor is implicitly disabled. This turns out to be very useful
// because we want users to be explicit when setting offset, len, and
// optional_read_size
FSAllocationPtr fs_scratch;
};

Expand Down

0 comments on commit 6aa94a1

Please sign in to comment.