|
| 1 | +// Copyright 2019 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#ifndef FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_PERSISTENCE_NOOP_PERSISTENCE_STORAGE_ENGINE_H_ |
| 16 | +#define FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_PERSISTENCE_NOOP_PERSISTENCE_STORAGE_ENGINE_H_ |
| 17 | + |
| 18 | +#include <cstdint> |
| 19 | +#include <set> |
| 20 | + |
| 21 | +#include "app/src/include/firebase/variant.h" |
| 22 | +#include "app/src/path.h" |
| 23 | +#include "database/src/desktop/core/compound_write.h" |
| 24 | +#include "database/src/desktop/persistence/persistence_storage_engine.h" |
| 25 | + |
| 26 | +namespace firebase { |
| 27 | +namespace database { |
| 28 | +namespace internal { |
| 29 | + |
| 30 | +class NoopPersistenceStorageEngine : public PersistenceStorageEngine { |
| 31 | + public: |
| 32 | + ~NoopPersistenceStorageEngine() override; |
| 33 | + |
| 34 | + void SaveUserOverwrite(const Path& path, const Variant& data, |
| 35 | + WriteId write_id) override; |
| 36 | + |
| 37 | + void SaveUserMerge(const Path& path, const CompoundWrite& children, |
| 38 | + WriteId write_id) override; |
| 39 | + |
| 40 | + void RemoveUserWrite(WriteId write_id) override; |
| 41 | + |
| 42 | + std::vector<UserWriteRecord> LoadUserWrites() override; |
| 43 | + |
| 44 | + void RemoveAllUserWrites() override; |
| 45 | + |
| 46 | + const Variant& ServerCache(const Path& path) override; |
| 47 | + |
| 48 | + void OverwriteServerCache(const Path& path, const Variant& data) override; |
| 49 | + |
| 50 | + void MergeIntoServerCache(const Path& path, const Variant& data) override; |
| 51 | + |
| 52 | + void MergeIntoServerCache(const Path& path, |
| 53 | + const CompoundWrite& children) override; |
| 54 | + |
| 55 | + void SaveTrackedQuery(const TrackedQuery& tracked_query) override; |
| 56 | + |
| 57 | + void DeleteTrackedQuery(QueryId query_id) override; |
| 58 | + |
| 59 | + std::vector<TrackedQuery> LoadTrackedQueries() override; |
| 60 | + |
| 61 | + void ResetPreviouslyActiveTrackedQueries(uint64_t last_use) override; |
| 62 | + |
| 63 | + void SaveTrackedQueryKeys(QueryId query_id, |
| 64 | + const std::set<std::string>& keys) override; |
| 65 | + |
| 66 | + void UpdateTrackedQueryKeys(QueryId query_id, |
| 67 | + const std::set<std::string>& added, |
| 68 | + const std::set<std::string>& removed) override; |
| 69 | + |
| 70 | + std::set<std::string> LoadTrackedQueryKeys(QueryId query_id) override; |
| 71 | + |
| 72 | + std::set<std::string> LoadTrackedQueryKeys( |
| 73 | + const std::set<QueryId>& query_ids) override; |
| 74 | + |
| 75 | + bool BeginTransaction() override; |
| 76 | + |
| 77 | + void EndTransaction() override; |
| 78 | + |
| 79 | + void SetTransactionSuccessful() override; |
| 80 | +}; |
| 81 | + |
| 82 | +} // namespace internal |
| 83 | +} // namespace database |
| 84 | +} // namespace firebase |
| 85 | + |
| 86 | +#endif // FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_PERSISTENCE_NOOP_PERSISTENCE_STORAGE_ENGINE_H_ |
0 commit comments