CCF
Loading...
Searching...
No Matches
service.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
5#include "ccf/crypto/pem.h"
6#include "ccf/ds/json.h"
7#include "ccf/service/map.h"
8#include "ccf/tx_id.h"
9
10namespace ccf
11{
12 enum class ServiceStatus
13 {
14 OPENING = 1,
15 OPEN = 2,
17 RECOVERING = 4
18 };
19
22 {{ServiceStatus::OPENING, "Opening"},
23 {ServiceStatus::OPEN, "Open"},
24 {ServiceStatus::WAITING_FOR_RECOVERY_SHARES, "WaitingForRecoveryShares"},
25 {ServiceStatus::RECOVERING, "Recovering"}});
26
28 {
34 std::optional<ccf::kv::Version> previous_service_identity_version =
35 std::nullopt;
37 std::optional<size_t> recovery_count = std::nullopt;
40 nlohmann::json service_data = nullptr;
42 std::optional<ccf::TxID> current_service_create_txid = std::nullopt;
43 };
48 previous_service_identity_version,
49 recovery_count,
50 service_data,
51 current_service_create_txid);
52
53 // As there is only one service active at a given time, it is stored in single
54 // Value in the KV
56 namespace Tables
57 {
58 static constexpr auto SERVICE = "public:ccf.gov.service.info";
59 }
60}
Definition pem.h:18
Definition value.h:32
#define DECLARE_JSON_REQUIRED_FIELDS(TYPE,...)
Definition json.h:714
#define DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(TYPE)
Definition json.h:690
#define DECLARE_JSON_OPTIONAL_FIELDS(TYPE,...)
Definition json.h:786
#define DECLARE_JSON_ENUM(TYPE,...)
Definition json.h:837
Definition app_interface.h:14
ServiceStatus
Definition service.h:13
Definition service.h:28
ServiceStatus status
Status of the service.
Definition service.h:32
std::optional< ccf::TxID > current_service_create_txid
TxID at which current service was created.
Definition service.h:42
std::optional< size_t > recovery_count
Number of disaster recoveries performed on this service.
Definition service.h:37
std::optional< ccf::kv::Version > previous_service_identity_version
Version (seqno) of previous service identity (before the last recovery)
Definition service.h:34
ccf::crypto::Pem cert
x.509 Service Certificate, as a PEM string
Definition service.h:30
nlohmann::json service_data
Definition service.h:40