diff options
author | zxu <zxu@google.com> | 2018-04-25 14:05:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-25 14:05:36 -0400 |
commit | f9bd6d3c9491dddbfc9cbe0fcc633030a66fe9da (patch) | |
tree | a396dca81e1fc06d8870acad723e56175b75bd05 /Firestore/Source/Local/FSTLevelDBQueryCache.mm | |
parent | 5ecdcc5ae1132d2cc0d532e580b31f70369ef319 (diff) |
Port `SnapshotVersion` for `Local` (#1182)
* no-brainer replace `FSTSnapshotVersion` with `SnapshotVersion`
* refresh code
* fix LocalStore
* fix LocalStore (partial revert 78e6c38)
* address changes
Diffstat (limited to 'Firestore/Source/Local/FSTLevelDBQueryCache.mm')
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBQueryCache.mm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Firestore/Source/Local/FSTLevelDBQueryCache.mm b/Firestore/Source/Local/FSTLevelDBQueryCache.mm index 5fde7d7..85b659a 100644 --- a/Firestore/Source/Local/FSTLevelDBQueryCache.mm +++ b/Firestore/Source/Local/FSTLevelDBQueryCache.mm @@ -18,6 +18,7 @@ #include <memory> #include <string> +#include <utility> #import "Firestore/Protos/objc/firestore/local/Target.pbobjc.h" #import "Firestore/Source/Core/FSTQuery.h" @@ -28,6 +29,7 @@ #import "Firestore/Source/Util/FSTAssert.h" #include "Firestore/core/src/firebase/firestore/model/document_key.h" +#include "Firestore/core/src/firebase/firestore/model/snapshot_version.h" #include "absl/strings/match.h" NS_ASSUME_NONNULL_BEGIN @@ -35,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN using firebase::firestore::local::LevelDbTransaction; using Firestore::StringView; using firebase::firestore::model::DocumentKey; +using firebase::firestore::model::SnapshotVersion; using leveldb::DB; using leveldb::Slice; using leveldb::Status; @@ -55,7 +58,7 @@ using leveldb::Status; * The last received snapshot version. This is part of `metadata` but we store it separately to * avoid extra conversion to/from GPBTimestamp. */ - FSTSnapshotVersion *_lastRemoteSnapshotVersion; + SnapshotVersion _lastRemoteSnapshotVersion; } + (nullable FSTPBTargetGlobal *)readTargetMetadataWithTransaction: @@ -135,13 +138,14 @@ using leveldb::Status; return self.metadata.highestListenSequenceNumber; } -- (FSTSnapshotVersion *)lastRemoteSnapshotVersion { +- (const SnapshotVersion &)lastRemoteSnapshotVersion { return _lastRemoteSnapshotVersion; } -- (void)setLastRemoteSnapshotVersion:(FSTSnapshotVersion *)snapshotVersion { - _lastRemoteSnapshotVersion = snapshotVersion; - self.metadata.lastRemoteSnapshotVersion = [self.serializer encodedVersion:snapshotVersion]; +- (void)setLastRemoteSnapshotVersion:(SnapshotVersion)snapshotVersion { + _lastRemoteSnapshotVersion = std::move(snapshotVersion); + self.metadata.lastRemoteSnapshotVersion = + [self.serializer encodedVersion:_lastRemoteSnapshotVersion]; _db.currentTransaction->Put([FSTLevelDBTargetGlobalKey key], self.metadata); } |