leveldb/db
Victor Costan a0191e5563 Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}.
The "DeleteFile" method name causes pain for Windows developers, because
<windows.h> #defines a DeleteFile macro to DeleteFileW or DeleteFileA.
Current code uses workarounds, like #undefining DeleteFile everywhere an
Env is declared, implemented, or used.

This CL removes the need for workarounds by renaming Env::DeleteFile to
Env::RemoveFile. For consistency, Env::DeleteDir is also renamed to
Env::RemoveDir. A few internal methods are also renamed for consistency.
Software that supports Windows is expected to migrate any Env
implementations and usage to Remove{File,Dir}, and never use the name
Env::Delete{File,Dir} in its code.

The renaming is done in a backwards-compatible way, at the risk of
making it slightly more difficult to build a new correct Env
implementation. The backwards compatibility is achieved using the
following hacks:

1) Env::Remove{File,Dir} methods are added, with a default
    implementation that calls into Env::Delete{File,Dir}. This makes old
    Env implementations compatible with code that calls into the updated
    API.
2) The Env::Delete{File,Dir} methods are no longer pure virtuals.
    Instead, they gain a default implementation that calls into
    Env::Remove{File,Dir}. This makes updated Env implementations
    compatible with code that calls into the old API.

The cost of this approach is that it's possible to write an Env without
overriding either Rename{File,Dir} or Delete{File,Dir}, without getting
a compiler warning. However, attempting to run the test suite will
immediately fail with an infinite call stack ending in
{Remove,Delete}{File,Dir}, making developers aware of the problem.

PiperOrigin-RevId: 288710907
2020-01-09 09:18:14 -08:00
..
autocompact_test.cc Internal change. 2019-12-02 11:44:39 -08:00
builder.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
builder.h Format all files IAW the Google C++ Style Guide. 2019-05-02 19:04:50 -07:00
c_test.c unsigned char -> uint8_t 2019-05-28 15:44:32 -07:00
c.cc unsigned char -> uint8_t 2019-05-28 15:44:32 -07:00
corruption_test.cc Internal change. 2019-12-02 11:44:39 -08:00
db_impl.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
db_impl.h Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
db_iter.cc Switch to using C++ 11 override specifier. 2019-05-09 14:11:06 -07:00
db_iter.h Format all files IAW the Google C++ Style Guide. 2019-05-02 19:04:50 -07:00
db_test.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
dbformat_test.cc Internal change. 2019-12-02 11:44:39 -08:00
dbformat.cc Using std::ostringstream in key DebugString. 2019-05-08 17:36:35 -07:00
dbformat.h unsigned char -> uint8_t 2019-05-28 15:44:32 -07:00
dumpfile.cc Switch to using C++ 11 override specifier. 2019-05-09 14:11:06 -07:00
fault_injection_test.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
filename_test.cc Internal change. 2019-12-02 11:44:39 -08:00
filename.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
filename.h Format all files IAW the Google C++ Style Guide. 2019-05-02 19:04:50 -07:00
leveldbutil.cc Switch to using C++ 11 override specifier. 2019-05-09 14:11:06 -07:00
log_format.h Convert documentation to markdown. 2017-03-01 09:42:25 -08:00
log_reader.cc Style cleanup. 2019-05-04 17:42:20 -07:00
log_reader.h Correct class/structure declaration order. 2019-05-03 09:48:57 -07:00
log_test.cc Internal change. 2019-12-02 11:44:39 -08:00
log_writer.cc Style cleanup. 2019-05-04 17:42:20 -07:00
log_writer.h Correct class/structure declaration order. 2019-05-03 09:48:57 -07:00
memtable.cc Style cleanup. 2019-05-04 17:42:20 -07:00
memtable.h Correct class/structure declaration order. 2019-05-03 09:48:57 -07:00
recovery_test.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
repair.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
skiplist_test.cc Internal change. 2019-12-02 11:44:39 -08:00
skiplist.h Correct class/structure declaration order. 2019-05-03 09:48:57 -07:00
snapshot.h Format all files IAW the Google C++ Style Guide. 2019-05-02 19:04:50 -07:00
table_cache.cc Format all files IAW the Google C++ Style Guide. 2019-05-02 19:04:50 -07:00
table_cache.h Correct class/structure declaration order. 2019-05-03 09:48:57 -07:00
version_edit_test.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
version_edit.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
version_edit.h Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
version_set_test.cc Internal change. 2019-12-02 11:44:39 -08:00
version_set.cc Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. 2020-01-09 09:18:14 -08:00
version_set.h Correct class/structure declaration order. 2019-05-03 09:48:57 -07:00
write_batch_internal.h Format all files IAW the Google C++ Style Guide. 2019-05-02 19:04:50 -07:00
write_batch_test.cc Internal change. 2019-12-02 11:44:39 -08:00
write_batch.cc Style cleanup. 2019-05-04 17:42:20 -07:00