From 5f5f80825820487e1c7ed964c94a472e84adc552 Mon Sep 17 00:00:00 2001 From: Greg Soltis Date: Tue, 13 Feb 2018 11:12:17 -0800 Subject: Keep track of number of queries in the query cache (#776) * Implement schema versions * Style fixes * newlines, copyrights, assumptions * Fix nullability * Raw ptr -> shared_ptr * kVersionTableGlobal -> kVersionGlobalTable * Drop utils, move into static methods * Drop extra include * Add a few more comments * Move version constant into migrations file * formatting? * Fix comment * Split add and update queryData * Work on adding targetCount * More work on count * Using shared_ptr * Implement count for query cache * use quotes * Add cast * Styling * Revert year bump in copyright * Add adversarial key to migration test * Add comment * Fix style --- Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj | 2 +- Firestore/Protos/objc/firestore/local/Target.pbobjc.h | 4 ++++ Firestore/Protos/objc/firestore/local/Target.pbobjc.m | 11 +++++++++++ Firestore/Protos/protos/firestore/local/target.proto | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) (limited to 'Firestore/Protos') diff --git a/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj b/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj index 51a61b8..2efcb21 100644 --- a/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj +++ b/Firestore/Protos/FrameworkMaker.xcodeproj/project.pbxproj @@ -201,7 +201,7 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-FrameworkMaker_iOS/Pods-FrameworkMaker_iOS-resources.sh", - "$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( diff --git a/Firestore/Protos/objc/firestore/local/Target.pbobjc.h b/Firestore/Protos/objc/firestore/local/Target.pbobjc.h index d8bf49c..0672a6e 100644 --- a/Firestore/Protos/objc/firestore/local/Target.pbobjc.h +++ b/Firestore/Protos/objc/firestore/local/Target.pbobjc.h @@ -160,6 +160,7 @@ typedef GPB_ENUM(FSTPBTargetGlobal_FieldNumber) { FSTPBTargetGlobal_FieldNumber_HighestTargetId = 1, FSTPBTargetGlobal_FieldNumber_HighestListenSequenceNumber = 2, FSTPBTargetGlobal_FieldNumber_LastRemoteSnapshotVersion = 3, + FSTPBTargetGlobal_FieldNumber_TargetCount = 4, }; /** @@ -197,6 +198,9 @@ typedef GPB_ENUM(FSTPBTargetGlobal_FieldNumber) { /** Test to see if @c lastRemoteSnapshotVersion has been set. */ @property(nonatomic, readwrite) BOOL hasLastRemoteSnapshotVersion; +/** On platforms that need it, holds the number of targets persisted. */ +@property(nonatomic, readwrite) int32_t targetCount; + @end NS_ASSUME_NONNULL_END diff --git a/Firestore/Protos/objc/firestore/local/Target.pbobjc.m b/Firestore/Protos/objc/firestore/local/Target.pbobjc.m index 6f6ccf2..567c86d 100644 --- a/Firestore/Protos/objc/firestore/local/Target.pbobjc.m +++ b/Firestore/Protos/objc/firestore/local/Target.pbobjc.m @@ -183,10 +183,12 @@ void FSTPBTarget_ClearTargetTypeOneOfCase(FSTPBTarget *message) { @dynamic highestTargetId; @dynamic highestListenSequenceNumber; @dynamic hasLastRemoteSnapshotVersion, lastRemoteSnapshotVersion; +@dynamic targetCount; typedef struct FSTPBTargetGlobal__storage_ { uint32_t _has_storage_[1]; int32_t highestTargetId; + int32_t targetCount; GPBTimestamp *lastRemoteSnapshotVersion; int64_t highestListenSequenceNumber; } FSTPBTargetGlobal__storage_; @@ -224,6 +226,15 @@ typedef struct FSTPBTargetGlobal__storage_ { .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, + { + .name = "targetCount", + .dataTypeSpecific.className = NULL, + .number = FSTPBTargetGlobal_FieldNumber_TargetCount, + .hasIndex = 3, + .offset = (uint32_t)offsetof(FSTPBTargetGlobal__storage_, targetCount), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt32, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[FSTPBTargetGlobal class] diff --git a/Firestore/Protos/protos/firestore/local/target.proto b/Firestore/Protos/protos/firestore/local/target.proto index 7f34515..7f0a886 100644 --- a/Firestore/Protos/protos/firestore/local/target.proto +++ b/Firestore/Protos/protos/firestore/local/target.proto @@ -87,4 +87,7 @@ message TargetGlobal { // This is updated whenever our we get a TargetChange with a read_time and // empty target_ids. google.protobuf.Timestamp last_remote_snapshot_version = 3; + + // On platforms that need it, holds the number of targets persisted. + int32 target_count = 4; } -- cgit v1.2.3