CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace cache {
30 template<
typename TCache,
typename TStorageTraits>
40 const std::string&
name()
const override {
46 const auto& view = cacheView.
sub<TCache>();
49 auto pIterableView = view.tryMakeIterableView();
50 for (
const auto& element : *pIterableView)
61 auto delta =
m_cache.createDelta();
65 loader.
next(batchSize, *delta);
75 TStorageTraits::Save(value, output);
78 template<
typename T1,
typename T2>
80 TStorageTraits::Save(pair.second, output);
Delta on top of a catapult cache.
Definition: CatapultCacheDelta.h:31
std::string m_name
Definition: CacheStorageAdapter.h:85
TCache & m_cache
Definition: CacheStorageAdapter.h:84
A CacheStorage implementation that wraps a cache and associated storage traits.
Definition: CacheStorageAdapter.h:31
Interface for loading and saving cache data.
Definition: CacheStorage.h:35
static void SaveValue(const T &value, io::OutputStream &output)
Definition: CacheStorageAdapter.h:74
static void SaveValue(const std::pair< T1, T2 > &pair, io::OutputStream &output)
Definition: CacheStorageAdapter.h:79
void loadAll(io::InputStream &input, size_t batchSize) override
Loads cache data from input in batches of batchSize.
Definition: CacheStorageAdapter.h:60
void next(uint64_t numRequestedEntries, typename TStorageTraits::DestinationType &destination)
Loads the next data chunk of at most numRequestedEntries into destination.
Definition: ChunkedDataLoader.h:44
void saveAll(const CatapultCacheView &cacheView, io::OutputStream &output) const override
Saves cache data from cacheView to output.
Definition: CacheStorageAdapter.h:45
static constexpr auto Name
Definition: PtSynchronizer.cpp:31
void Write64(TIo &output, uint64_t value)
Writes value into output.
Definition: PodIoUtils.h:36
Locked view on top of the catapult cache.
Definition: CatapultCacheView.h:36
const TCache::CacheViewType & sub() const
Gets a specific sub cache view.
Definition: CatapultCacheView.h:52
Loads data from an input stream in chunks.
Definition: ChunkedDataLoader.h:30
bool hasNext() const
Returns true if there are more entries in the input.
Definition: ChunkedDataLoader.h:39
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
Definition: AddressExtractionExtension.cpp:28
void saveSummary(const CatapultCacheDelta &, io::OutputStream &) const override
Saves cache (summary) data from cacheDelta to output.
Definition: CacheStorageAdapter.h:56
const std::string & name() const override
Gets the cache name.
Definition: CacheStorageAdapter.h:40
CacheStorageAdapter(TCache &cache)
Creates an adapter around cache.
Definition: CacheStorageAdapter.h:34
Writer interface.
Definition: Stream.h:41