nigori_storage.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2019 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. #ifndef COMPONENTS_SYNC_NIGORI_NIGORI_STORAGE_H_
  5. #define COMPONENTS_SYNC_NIGORI_NIGORI_STORAGE_H_
  6. #include "components/sync/protocol/nigori_local_data.pb.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace syncer {
  9. // Interface for storing/loading Nigori data from the disk.
  10. class NigoriStorage {
  11. public:
  12. NigoriStorage() = default;
  13. NigoriStorage(const NigoriStorage&) = delete;
  14. NigoriStorage& operator=(const NigoriStorage&) = delete;
  15. virtual ~NigoriStorage() = default;
  16. // Should atomically persist |data|.
  17. virtual void StoreData(const sync_pb::NigoriLocalData& data) = 0;
  18. // Returns previously stored NigoriLocalData. In case error occurs or no data
  19. // was stored, returns absl::nullopt.
  20. virtual absl::optional<sync_pb::NigoriLocalData> RestoreData() = 0;
  21. // Removes all previously stored data.
  22. virtual void ClearData() = 0;
  23. };
  24. } // namespace syncer
  25. #endif // COMPONENTS_SYNC_NIGORI_NIGORI_STORAGE_H_