alanlxl | 30f15bd | 2020-08-11 21:26:12 +1000 | [diff] [blame^] | 1 | // Copyright 2020 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "federated/storage_manager_impl.h" |
| 6 | |
| 7 | #include <base/logging.h> |
| 8 | #include <base/no_destructor.h> |
| 9 | |
| 10 | namespace federated { |
| 11 | |
| 12 | bool StorageManagerImpl::OnExampleReceived( |
| 13 | const std::string& client_name, const std::string& serialized_example) { |
| 14 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 15 | // TODO(alanlxl): Insert data into DB |
| 16 | return true; |
| 17 | } |
| 18 | |
| 19 | bool StorageManagerImpl::PrepareStreamingForClient( |
| 20 | const std::string& client_name) { |
| 21 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 22 | // TODO(alanlxl): Query DB if there're examples for the given client. |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | bool StorageManagerImpl::GetNextExample(std::string* example) { |
| 27 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 28 | // TODO(alanlxl): query DB for the next example. |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | bool StorageManagerImpl::CloseStreaming() { |
| 33 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 34 | |
| 35 | // TODO(alanlxl): we can clean the used examples here. |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | StorageManager* StorageManager::GetInstance() { |
| 40 | static base::NoDestructor<StorageManagerImpl> storage_manager; |
| 41 | return storage_manager.get(); |
| 42 | } |
| 43 | |
| 44 | } // namespace federated |