mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Tidy up nudb:
* Define WIN32_LEAN_AND_MEAN before including Windows.h * Remove unnecessary template argument * Rename to identity * Make identity default api codec
This commit is contained in:
committed by
Tom Ritchford
parent
ac7243b309
commit
d537ceedd6
@@ -946,7 +946,7 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\nudb\file.h">
|
<ClInclude Include="..\..\src\beast\beast\nudb\file.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\nudb\identity_codec.h">
|
<ClInclude Include="..\..\src\beast\beast\nudb\identity.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\nudb\nudb.cpp">
|
<ClCompile Include="..\..\src\beast\beast\nudb\nudb.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
|||||||
@@ -1554,7 +1554,7 @@
|
|||||||
<ClInclude Include="..\..\src\beast\beast\nudb\file.h">
|
<ClInclude Include="..\..\src\beast\beast\nudb\file.h">
|
||||||
<Filter>beast\nudb</Filter>
|
<Filter>beast\nudb</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\nudb\identity_codec.h">
|
<ClInclude Include="..\..\src\beast\beast\nudb\identity.h">
|
||||||
<Filter>beast\nudb</Filter>
|
<Filter>beast\nudb</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\nudb\nudb.cpp">
|
<ClCompile Include="..\..\src\beast\beast\nudb\nudb.cpp">
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define BEAST_NUDB_API_H_INCLUDED
|
#define BEAST_NUDB_API_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/nudb/create.h>
|
#include <beast/nudb/create.h>
|
||||||
|
#include <beast/nudb/identity.h>
|
||||||
#include <beast/nudb/store.h>
|
#include <beast/nudb/store.h>
|
||||||
#include <beast/nudb/recover.h>
|
#include <beast/nudb/recover.h>
|
||||||
#include <beast/nudb/verify.h>
|
#include <beast/nudb/verify.h>
|
||||||
@@ -34,7 +35,7 @@ namespace nudb {
|
|||||||
//
|
//
|
||||||
template <
|
template <
|
||||||
class Hasher,
|
class Hasher,
|
||||||
class Codec,
|
class Codec = identity,
|
||||||
class File = native_file,
|
class File = native_file,
|
||||||
std::size_t BufferSize = 16 * 1024 * 1024
|
std::size_t BufferSize = 16 * 1024 * 1024
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ namespace beast {
|
|||||||
namespace nudb {
|
namespace nudb {
|
||||||
|
|
||||||
/** Codec which maps input directly to output. */
|
/** Codec which maps input directly to output. */
|
||||||
class identity_codec
|
class identity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
explicit
|
explicit
|
||||||
identity_codec(Args&&... args)
|
identity(Args&&... args)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ store<Hasher, Codec, File>::open (
|
|||||||
key_file_header kh;
|
key_file_header kh;
|
||||||
read (df, dh);
|
read (df, dh);
|
||||||
read (kf, kh);
|
read (kf, kh);
|
||||||
verify<Codec> (dh);
|
verify (dh);
|
||||||
verify<Hasher> (kh);
|
verify<Hasher> (kh);
|
||||||
verify<Hasher> (dh, kh);
|
verify<Hasher> (dh, kh);
|
||||||
auto s = std::make_unique<state>(
|
auto s = std::make_unique<state>(
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define BEAST_NUDB_TESTS_COMMON_H_INCLUDED
|
#define BEAST_NUDB_TESTS_COMMON_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/nudb.h>
|
#include <beast/nudb.h>
|
||||||
#include <beast/nudb/identity_codec.h>
|
#include <beast/nudb/identity.h>
|
||||||
#include <beast/nudb/tests/fail_file.h>
|
#include <beast/nudb/tests/fail_file.h>
|
||||||
#include <beast/hash/xxhasher.h>
|
#include <beast/hash/xxhasher.h>
|
||||||
#include <beast/random/xor_shift_engine.h>
|
#include <beast/random/xor_shift_engine.h>
|
||||||
@@ -37,7 +37,7 @@ using key_type = std::size_t;
|
|||||||
|
|
||||||
// xxhasher is fast and produces good results
|
// xxhasher is fast and produces good results
|
||||||
using test_api_base =
|
using test_api_base =
|
||||||
nudb::api<xxhasher, identity_codec, native_file>;
|
nudb::api<xxhasher, identity, native_file>;
|
||||||
|
|
||||||
struct test_api : test_api_base
|
struct test_api : test_api_base
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ visit(
|
|||||||
df.open (file_mode::scan, path);
|
df.open (file_mode::scan, path);
|
||||||
dat_file_header dh;
|
dat_file_header dh;
|
||||||
read (df, dh);
|
read (df, dh);
|
||||||
verify<Codec> (dh);
|
verify (dh);
|
||||||
Codec codec;
|
Codec codec;
|
||||||
// Iterate Data File
|
// Iterate Data File
|
||||||
bulk_reader<File> r(
|
bulk_reader<File> r(
|
||||||
|
|||||||
@@ -42,6 +42,9 @@
|
|||||||
# ifndef STRICT
|
# ifndef STRICT
|
||||||
# define STRICT
|
# define STRICT
|
||||||
# endif
|
# endif
|
||||||
|
# ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
# undef NOMINMAX
|
# undef NOMINMAX
|
||||||
# undef UNICODE
|
# undef UNICODE
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include <ripple/nodestore/impl/EncodedBlob.h>
|
#include <ripple/nodestore/impl/EncodedBlob.h>
|
||||||
#include <beast/nudb.h>
|
#include <beast/nudb.h>
|
||||||
#include <beast/nudb/detail/varint.h>
|
#include <beast/nudb/detail/varint.h>
|
||||||
#include <beast/nudb/identity_codec.h>
|
|
||||||
#include <beast/nudb/visit.h>
|
#include <beast/nudb/visit.h>
|
||||||
#include <beast/hash/xxhasher.h>
|
#include <beast/hash/xxhasher.h>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user