xref: /aosp_15_r20/external/federated-compute/fcp/secagg/server/secagg_server_aborted_state.cc (revision 14675a029014e728ec732f129a32e299b2da0601)
1 /*
2  * Copyright 2018 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "fcp/secagg/server/secagg_server_aborted_state.h"
18 
19 #include <memory>
20 #include <string>
21 #include <utility>
22 
23 namespace fcp {
24 namespace secagg {
25 
SecAggServerAbortedState(const std::string & error_message,std::unique_ptr<SecAggServerProtocolImpl> impl,int number_of_clients_failed_after_sending_masked_input,int number_of_clients_failed_before_sending_masked_input,int number_of_clients_terminated_without_unmasking)26 SecAggServerAbortedState::SecAggServerAbortedState(
27     const std::string& error_message,
28     std::unique_ptr<SecAggServerProtocolImpl> impl,
29     int number_of_clients_failed_after_sending_masked_input,
30     int number_of_clients_failed_before_sending_masked_input,
31     int number_of_clients_terminated_without_unmasking)
32     : SecAggServerState(number_of_clients_failed_after_sending_masked_input,
33                         number_of_clients_failed_before_sending_masked_input,
34                         number_of_clients_terminated_without_unmasking,
35                         SecAggServerStateKind::ABORTED, std::move(impl)),
36       error_message_(error_message) {}
37 
~SecAggServerAbortedState()38 SecAggServerAbortedState::~SecAggServerAbortedState() {}
39 
IsAborted() const40 bool SecAggServerAbortedState::IsAborted() const { return true; }
41 
ErrorMessage() const42 StatusOr<std::string> SecAggServerAbortedState::ErrorMessage() const {
43   return error_message_;
44 }
45 
IsNumberOfIncludedInputsCommitted() const46 bool SecAggServerAbortedState::IsNumberOfIncludedInputsCommitted() const {
47   return true;
48 }
49 
50 }  // namespace secagg
51 }  // namespace fcp
52