CCF
Loading...
Searching...
No Matches
unit.h
Go to the documentation of this file.
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the Apache 2.0 License.
3#pragma once
4
6
8{
9 // Unit serialisations are used as a utility type to convert ccf::kv::Maps to
10 // ccf::kv::Maps and ccf::kv::Sets. Specifically, these are implemented as
11 // wrappers so that ccf::kv::Value<T> is essentially ccf::kv::Map<Unit, T>,
12 // and ccf::kv::Set<T> is ccf::kv::Map<T, Unit>. This is used as a template
13 // parameter allowing the caller to specify what value is inserted into the
14 // ledger.
15
16 // This is the default UnitCreator, returning 8 null bytes for compatibility
17 // with old ledgers (where Values were previously Maps with a single entry
18 // at key 0, serialised as a uint64_t)
20 {
22 {
24 e.assign(sizeof(uint64_t), 0u);
25 return e;
26 }
27 };
28
30 {
32 {
33 return {};
34 }
35 };
36}
Definition sha256_hash.h:80
ccf::ByteVector SerialisedEntry
Definition serialised_entry.h:8
static ccf::kv::serialisers::SerialisedEntry get()
Definition unit.h:31
static ccf::kv::serialisers::SerialisedEntry get()
Definition unit.h:21