-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use random_access_file for ship log; refactor catalog
- Loading branch information
1 parent
bd4fa28
commit 078145e
Showing
11 changed files
with
1,383 additions
and
878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
libraries/state_history/include/eosio/state_history/compression.hpp
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
libraries/state_history/include/eosio/state_history/counter.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#pragma once | ||
|
||
#include <boost/iostreams/filtering_streambuf.hpp> | ||
|
||
namespace eosio::detail { | ||
|
||
namespace bio = boost::iostreams; | ||
|
||
// directly adapt from boost/iostreams/filter/counter.hpp and change the type of chars_ to uint64_t. | ||
class counter { | ||
public: | ||
typedef char char_type; | ||
struct category | ||
: bio::dual_use, | ||
bio::filter_tag, | ||
bio::multichar_tag, | ||
bio::optimally_buffered_tag | ||
{ }; | ||
|
||
uint64_t characters() const { return chars_; } | ||
std::streamsize optimal_buffer_size() const { return 64*1024; } | ||
|
||
template<typename Source> | ||
std::streamsize read(Source& src, char_type* s, std::streamsize n) | ||
{ | ||
std::streamsize result = bio::read(src, s, n); | ||
if (result == -1) | ||
return -1; | ||
chars_ += result; | ||
return result; | ||
} | ||
|
||
template<typename Sink> | ||
std::streamsize write(Sink& snk, const char_type* s, std::streamsize n) | ||
{ | ||
std::streamsize result = bio::write(snk, s, n); | ||
chars_ += result; | ||
return result; | ||
} | ||
|
||
private: | ||
uint64_t chars_ = 0; | ||
}; | ||
BOOST_IOSTREAMS_PIPABLE(counter, 0) | ||
|
||
} |
Oops, something went wrong.