xref: /aosp_15_r20/external/federated-compute/fcp/aggregation/protocol/resource_resolver.h (revision 14675a029014e728ec732f129a32e299b2da0601)
1 /*
2  * Copyright 2023 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 #ifndef FCP_AGGREGATION_PROTOCOL_RESOURCE_RESOLVER_H_
18 #define FCP_AGGREGATION_PROTOCOL_RESOURCE_RESOLVER_H_
19 
20 #include <memory>
21 #include <string>
22 
23 #include "absl/status/statusor.h"
24 #include "absl/strings/cord.h"
25 
26 namespace fcp::aggregation {
27 
28 // Describes an abstract interface for resolving a resource from a given client
29 // and uri.
30 class ResourceResolver {
31  public:
32   virtual ~ResourceResolver() = default;
33 
34   // Retrieves a resource for the given `client_id` and `uri` combination.
35   // The resource can be accessed exactly once and must be deleted (best-effort)
36   // after it is returned.
37   virtual absl::StatusOr<absl::Cord> RetrieveResource(
38       int64_t client_id, const std::string& uri) = 0;
39 };
40 }  // namespace fcp::aggregation
41 
42 #endif  // FCP_AGGREGATION_PROTOCOL_RESOURCE_RESOLVER_H_
43