Skip to content

Commit cf630bf

Browse files
authored
Port FSTLevelDBKey to C++ (#937)
1 parent 5f49b2f commit cf630bf

File tree

11 files changed

+1744
-5
lines changed

11 files changed

+1744
-5
lines changed

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
5492E0C92021557E00B64F25 /* FSTRemoteEventTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E0C32021557E00B64F25 /* FSTRemoteEventTests.mm */; };
109109
5492E0CA2021557E00B64F25 /* FSTWatchChangeTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5492E0C52021557E00B64F25 /* FSTWatchChangeTests.mm */; };
110110
5495EB032040E90200EBA509 /* CodableGeoPointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5495EB022040E90200EBA509 /* CodableGeoPointTests.swift */; };
111+
54995F6F205B6E12004EFFA0 /* leveldb_key_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54995F6E205B6E12004EFFA0 /* leveldb_key_test.cc */; };
111112
54C2294F1FECABAE007D065B /* log_test.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54C2294E1FECABAE007D065B /* log_test.cc */; };
112113
54DA12A61F315EE100DD57A1 /* collection_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA129C1F315EE100DD57A1 /* collection_spec_test.json */; };
113114
54DA12A71F315EE100DD57A1 /* existence_filter_spec_test.json in Resources */ = {isa = PBXBuildFile; fileRef = 54DA129D1F315EE100DD57A1 /* existence_filter_spec_test.json */; };
@@ -324,6 +325,7 @@
324325
5492E0C42021557E00B64F25 /* FSTWatchChange+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FSTWatchChange+Testing.h"; sourceTree = "<group>"; };
325326
5492E0C52021557E00B64F25 /* FSTWatchChangeTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FSTWatchChangeTests.mm; sourceTree = "<group>"; };
326327
5495EB022040E90200EBA509 /* CodableGeoPointTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodableGeoPointTests.swift; sourceTree = "<group>"; };
328+
54995F6E205B6E12004EFFA0 /* leveldb_key_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = leveldb_key_test.cc; path = ../../core/test/firebase/firestore/local/leveldb_key_test.cc; sourceTree = "<group>"; };
327329
54C2294E1FECABAE007D065B /* log_test.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = log_test.cc; path = ../../core/test/firebase/firestore/util/log_test.cc; sourceTree = "<group>"; };
328330
54C9EDF12040E16300A969CD /* Firestore_SwiftTests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Firestore_SwiftTests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
329331
54C9EDF52040E16300A969CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -496,6 +498,7 @@
496498
AB38D9312023962A000A432D /* auth */,
497499
AB380CF7201937B800D97691 /* core */,
498500
54EB764B202277970088B8F3 /* immutable */,
501+
54995F70205B6E1A004EFFA0 /* local */,
499502
AB356EF5200E9D1A0089B766 /* model */,
500503
5467FB05203E652F009C9584 /* testutil */,
501504
54740A561FC913EB00713A1A /* util */,
@@ -513,6 +516,14 @@
513516
path = Codable;
514517
sourceTree = "<group>";
515518
};
519+
54995F70205B6E1A004EFFA0 /* local */ = {
520+
isa = PBXGroup;
521+
children = (
522+
54995F6E205B6E12004EFFA0 /* leveldb_key_test.cc */,
523+
);
524+
name = local;
525+
sourceTree = "<group>";
526+
};
516527
54C9EDF22040E16300A969CD /* SwiftTests */ = {
517528
isa = PBXGroup;
518529
children = (
@@ -1514,6 +1525,7 @@
15141525
5492E0B92021555100B64F25 /* FSTDocumentKeyTests.mm in Sources */,
15151526
DE2EF0871F3D0B6E003D0CDC /* FSTImmutableSortedSet+Testing.m in Sources */,
15161527
5492E0C82021557E00B64F25 /* FSTDatastoreTests.mm in Sources */,
1528+
54995F6F205B6E12004EFFA0 /* leveldb_key_test.cc in Sources */,
15171529
5492E065202154B900B64F25 /* FSTViewTests.mm in Sources */,
15181530
5492E03C2021401F00B64F25 /* XCTestCase+Await.mm in Sources */,
15191531
B6152AD7202A53CB000E5744 /* document_key_test.cc in Sources */,

Firestore/Source/Core/FSTTypes.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19+
#include "Firestore/core/src/firebase/firestore/model/types.h"
20+
1921
NS_ASSUME_NONNULL_BEGIN
2022

2123
@class FSTMaybeDocument;
2224
@class FSTTransaction;
2325

2426
/** FSTBatchID is a locally assigned ID for a batch of mutations that have been applied. */
25-
typedef int32_t FSTBatchID;
27+
typedef firebase::firestore::model::BatchId FSTBatchID;
2628

27-
typedef int32_t FSTTargetID;
29+
typedef firebase::firestore::model::TargetId FSTTargetID;
2830

2931
typedef int64_t FSTListenSequenceNumber;
3032

Firestore/core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ add_subdirectory(src/firebase/firestore)
1616
add_subdirectory(src/firebase/firestore/auth)
1717
add_subdirectory(src/firebase/firestore/core)
1818
add_subdirectory(src/firebase/firestore/immutable)
19+
add_subdirectory(src/firebase/firestore/local)
1920
add_subdirectory(src/firebase/firestore/model)
2021
add_subdirectory(src/firebase/firestore/remote)
2122
add_subdirectory(src/firebase/firestore/util)
@@ -25,6 +26,7 @@ add_subdirectory(test/firebase/firestore)
2526
add_subdirectory(test/firebase/firestore/auth)
2627
add_subdirectory(test/firebase/firestore/core)
2728
add_subdirectory(test/firebase/firestore/immutable)
29+
add_subdirectory(test/firebase/firestore/local)
2830
add_subdirectory(test/firebase/firestore/model)
2931
add_subdirectory(test/firebase/firestore/remote)
3032
add_subdirectory(test/firebase/firestore/util)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2018 Google
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+
cc_library(
16+
firebase_firestore_local
17+
SOURCES
18+
leveldb_key.h
19+
leveldb_key.cc
20+
DEPENDS
21+
LevelDB::LevelDB
22+
absl_strings
23+
firebase_firestore_model
24+
firebase_firestore_util
25+
)

0 commit comments

Comments
 (0)