Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium 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 #ifndef COMPONENTS_METRICS_LOG_STORE_H_ | |
| 6 #define COMPONENTS_METRICS_LOG_STORE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 namespace metrics { | |
| 11 | |
| 12 // Interface for local storage of logs to be reported. | |
|
rkaplow
2017/02/20 21:24:13
nit, since you're organizing this into an interfac
Steven Holte
2017/02/21 21:51:18
Done.
| |
| 13 class LogStore { | |
| 14 public: | |
| 15 // Returns true if there are any logs waiting to be uploaded. | |
| 16 virtual bool has_unsent_logs() const = 0; | |
| 17 | |
| 18 // Returns true if there is a log that needs to be, or is being, uploaded. | |
| 19 virtual bool has_staged_log() const = 0; | |
| 20 | |
| 21 // The text of the staged log, as a serialized protobuf. | |
| 22 // Will trigger a DCHECK if there is no staged log. | |
| 23 virtual const std::string& staged_log() const = 0; | |
| 24 | |
| 25 // The SHA1 hash of the staged log. | |
| 26 // Will trigger a DCHECK if there is no staged log. | |
| 27 virtual const std::string& staged_log_hash() const = 0; | |
| 28 | |
| 29 // Populates staged_log() with the next stored log to send. | |
| 30 // The staged_log will remain the same even if additional logs are added. | |
|
rkaplow
2017/02/20 21:24:13
can you define a bit more what 'next' means in thi
Steven Holte
2017/02/21 21:51:18
Added a comment saying this is explicitly left to
| |
| 31 // Should only be called if has_unsent_logs() is true. | |
| 32 virtual void StageNextLog() = 0; | |
| 33 | |
| 34 // Discards the staged log. | |
| 35 virtual void DiscardStagedLog() = 0; | |
| 36 | |
| 37 // Saves any unsent logs to persistent storage. | |
| 38 virtual void PersistUnsentLogs() const = 0; | |
| 39 | |
| 40 // Loads unsent logs from persistent storage. | |
| 41 virtual void LoadPersistedUnsentLogs() = 0; | |
| 42 }; | |
| 43 | |
| 44 } // namespace metrics | |
| 45 | |
| 46 #endif // COMPONENTS_METRICS_LOG_STORE_H_ | |
| OLD | NEW |