CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 namespace catapult {
namespace cache {
30 template<
typename TSerializer,
typename TCacheDelta,
typename TValue>
32 auto writeAllFrom = [&outputStream](
const auto& source) {
33 for (
const auto* pValue : source)
34 TSerializer::Save(*pValue, outputStream);
45 writeAllFrom(addedElements);
46 writeAllFrom(removedElements);
47 writeAllFrom(modifiedElements);
51 template<
typename TSerializer,
typename TValue>
53 auto readAllInto = [&inputStream](
auto& dest,
auto count) {
54 for (
auto i = 0u; i < count; ++i)
55 dest.push_back(TSerializer::Load(inputStream));
62 readAllInto(changes.
Added, numAdded);
63 readAllInto(changes.
Removed, numRemoved);
64 readAllInto(changes.
Copied, numCopied);
void WriteCacheChanges(const SingleCacheChangesT< TCacheDelta, TValue > &changes, io::OutputStream &outputStream)
Writes serialized cache changes into outputStream.
Definition: CacheChangesSerializer.h:31
std::vector< TValue > Added
Added elements.
Definition: CacheChanges.h:40
Provides common view of single sub cache changes.
Definition: CacheChanges.h:59
std::vector< TValue > Copied
Copied elements.
Definition: CacheChanges.h:46
void ReadCacheChanges(io::InputStream &inputStream, MemoryCacheChangesT< TValue > &changes)
Reads serialized cache changes from inputStream.
Definition: CacheChangesSerializer.h:52
Deserialized cache changes for a single cache.
Definition: CacheChanges.h:38
void Write64(TIo &output, uint64_t value)
Writes value into output.
Definition: PodIoUtils.h:36
PointerContainer addedElements() const
Gets pointers to all added elements.
Definition: CacheChanges.h:78
Definition: AddressExtractionExtension.cpp:28
auto Read64(TIo &input)
Reads value from input.
Definition: PodIoUtils.h:66
std::vector< TValue > Removed
Removed elements.
Definition: CacheChanges.h:43
PointerContainer modifiedElements() const
Gets pointers to all modified elements.
Definition: CacheChanges.h:83
Writer interface.
Definition: Stream.h:41
PointerContainer removedElements() const
Gets pointers to all removed elements.
Definition: CacheChanges.h:88