Skip to content

Commit 168a914

Browse files
committed
Hide realtime pipeline
1 parent 5c6d908 commit 168a914

File tree

16 files changed

+81
-126
lines changed

16 files changed

+81
-126
lines changed

firebase-firestore/api.txt

Lines changed: 35 additions & 97 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=26.0.3
1+
version=99.0.0-pipeline.preview.1
22
latestReleasedVersion=26.0.2

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ public PipelineSource pipeline() {
931931
* @return {@code RealtimePipelineSource} for this Firestore instance.
932932
*/
933933
@NonNull
934-
public RealtimePipelineSource realtimePipeline() {
934+
RealtimePipelineSource realtimePipeline() {
935935
clientProvider.ensureConfigured();
936936
return new RealtimePipelineSource(this);
937937
}

firebase-firestore/src/main/java/com/google/firebase/firestore/RealtimePipeline.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ import kotlinx.coroutines.channels.awaitClose
5050
import kotlinx.coroutines.flow.Flow
5151
import kotlinx.coroutines.flow.callbackFlow
5252

53-
class RealtimePipelineSource internal constructor(private val firestore: FirebaseFirestore) {
53+
internal class RealtimePipelineSource
54+
internal constructor(private val firestore: FirebaseFirestore) {
5455
/**
5556
* Convert the given Query into an equivalent Pipeline.
5657
*
@@ -129,7 +130,7 @@ class RealtimePipelineSource internal constructor(private val firestore: Firebas
129130
)
130131
}
131132

132-
class RealtimePipeline
133+
internal class RealtimePipeline
133134
internal constructor(
134135
// This is nullable because RealtimePipeline is also created from deserialization from persistent
135136
// cache. In that case, it is only used to facilitate remote store requests, and this field is

firebase-firestore/src/main/java/com/google/firebase/firestore/core/PipelineUtil.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import com.google.firebase.firestore.util.Assert.hardAssert
3232

3333
/** A class that wraps either a Query or a RealtimePipeline. */
3434
sealed class QueryOrPipeline {
35-
data class QueryWrapper(val query: Query) : QueryOrPipeline()
36-
data class PipelineWrapper(val pipeline: RealtimePipeline) : QueryOrPipeline()
35+
internal data class QueryWrapper(internal val query: Query) : QueryOrPipeline()
36+
internal data class PipelineWrapper(internal val pipeline: RealtimePipeline) : QueryOrPipeline()
3737

3838
val isQuery: Boolean
3939
get() = this is QueryWrapper
@@ -45,7 +45,7 @@ sealed class QueryOrPipeline {
4545
return (this as QueryWrapper).query
4646
}
4747

48-
fun pipeline(): RealtimePipeline {
48+
internal fun pipeline(): RealtimePipeline {
4949
return (this as PipelineWrapper).pipeline
5050
}
5151

@@ -102,7 +102,7 @@ sealed class QueryOrPipeline {
102102
/** A class that wraps either a Target or a RealtimePipeline. */
103103
sealed class TargetOrPipeline {
104104
data class TargetWrapper(val target: Target) : TargetOrPipeline()
105-
data class PipelineWrapper(val pipeline: RealtimePipeline) : TargetOrPipeline()
105+
internal data class PipelineWrapper(val pipeline: RealtimePipeline) : TargetOrPipeline()
106106

107107
val isTarget: Boolean
108108
get() = this is TargetWrapper
@@ -114,7 +114,7 @@ sealed class TargetOrPipeline {
114114
return (this as TargetWrapper).target
115115
}
116116

117-
fun pipeline(): RealtimePipeline {
117+
internal fun pipeline(): RealtimePipeline {
118118
return (this as PipelineWrapper).pipeline
119119
}
120120

@@ -178,15 +178,15 @@ enum class PipelineSourceType {
178178
}
179179

180180
// Determines the flavor of the given pipeline based on its stages.
181-
fun getPipelineFlavor(pipeline: RealtimePipeline): PipelineFlavor {
181+
internal fun getPipelineFlavor(pipeline: RealtimePipeline): PipelineFlavor {
182182
// For now, it is only possible to construct RealtimePipeline that is kExact.
183183
// PORTING NOTE: the typescript implementation support other flavors already,
184184
// despite not being used. We can port that later.
185185
return PipelineFlavor.EXACT
186186
}
187187

188188
// Determines the source type of the given pipeline based on its first stage.
189-
fun getPipelineSourceType(pipeline: RealtimePipeline): PipelineSourceType {
189+
internal fun getPipelineSourceType(pipeline: RealtimePipeline): PipelineSourceType {
190190
hardAssert(
191191
!pipeline.stages.isEmpty(),
192192
"Pipeline must have at least one stage to determine its source.",
@@ -202,7 +202,7 @@ fun getPipelineSourceType(pipeline: RealtimePipeline): PipelineSourceType {
202202

203203
// Retrieves the collection group ID if the pipeline's source is a collection
204204
// group.
205-
fun getPipelineCollectionGroup(pipeline: RealtimePipeline): String? {
205+
internal fun getPipelineCollectionGroup(pipeline: RealtimePipeline): String? {
206206
if (getPipelineSourceType(pipeline) == PipelineSourceType.COLLECTION_GROUP) {
207207
hardAssert(
208208
!pipeline.stages.isEmpty(),
@@ -217,7 +217,7 @@ fun getPipelineCollectionGroup(pipeline: RealtimePipeline): String? {
217217
}
218218

219219
// Retrieves the collection path if the pipeline's source is a collection.
220-
fun getPipelineCollection(pipeline: RealtimePipeline): String? {
220+
internal fun getPipelineCollection(pipeline: RealtimePipeline): String? {
221221
if (getPipelineSourceType(pipeline) == PipelineSourceType.COLLECTION) {
222222
hardAssert(
223223
!pipeline.stages.isEmpty(),
@@ -232,7 +232,7 @@ fun getPipelineCollection(pipeline: RealtimePipeline): String? {
232232
}
233233

234234
// Retrieves the document pathes if the pipeline's source is a document source.
235-
fun getPipelineDocuments(pipeline: RealtimePipeline): Array<out String>? {
235+
internal fun getPipelineDocuments(pipeline: RealtimePipeline): Array<out String>? {
236236
if (getPipelineSourceType(pipeline) == PipelineSourceType.DOCUMENTS) {
237237
hardAssert(
238238
!pipeline.stages.isEmpty(),
@@ -248,7 +248,7 @@ fun getPipelineDocuments(pipeline: RealtimePipeline): Array<out String>? {
248248

249249
// Creates a new pipeline by replacing CollectionGroupSource stages with
250250
// CollectionSource stages using the provided path.
251-
fun asCollectionPipelineAtPath(
251+
internal fun asCollectionPipelineAtPath(
252252
pipeline: RealtimePipeline,
253253
path: ResourcePath,
254254
): RealtimePipeline {
@@ -271,7 +271,7 @@ fun asCollectionPipelineAtPath(
271271
)
272272
}
273273

274-
fun getLastEffectiveLimit(pipeline: RealtimePipeline): Int? {
274+
internal fun getLastEffectiveLimit(pipeline: RealtimePipeline): Int? {
275275
for (stagePtr in pipeline.rewrittenStages.asReversed()) {
276276
// Check if the stage is a LimitStage
277277
if (stagePtr is LimitStage) {

firebase-firestore/src/main/java/com/google/firebase/firestore/core/QueryListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public QueryListener(
5656
if (query.isPipeline()) {
5757
this.query =
5858
new QueryOrPipeline.PipelineWrapper(
59-
query.pipeline().withListenOptions$com_google_firebase_firebase_firestore(options));
59+
query
60+
.pipeline$com_google_firebase_firebase_firestore()
61+
.withListenOptions$com_google_firebase_firebase_firestore(options));
6062
} else {
6163
this.query = query;
6264
}

firebase-firestore/src/main/java/com/google/firebase/firestore/core/View.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ public DocumentChanges computeDocChanges(
245245
candidates.add((MutableDocument) doc);
246246
}
247247
List<MutableDocument> results =
248-
this.query.pipeline().evaluate$com_google_firebase_firebase_firestore(candidates);
248+
this.query
249+
.pipeline$com_google_firebase_firebase_firestore()
250+
.evaluate$com_google_firebase_firebase_firestore(candidates);
249251
DocumentSet newResults = DocumentSet.emptySet(query.comparator());
250252
for (MutableDocument doc : results) {
251253
newResults = newResults.add(doc);
@@ -505,7 +507,8 @@ private static int changeTypeOrder(DocumentViewChange change) {
505507
@Nullable
506508
private static Long getLimit(QueryOrPipeline query) {
507509
if (query.isPipeline()) {
508-
Integer limit = getLastEffectiveLimit(query.pipeline());
510+
Integer limit =
511+
getLastEffectiveLimit(query.pipeline$com_google_firebase_firebase_firestore());
509512
if (limit == null) {
510513
return null;
511514
}

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalDocumentsView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ private ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingCollection
400400

401401
private ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingPipeline(
402402
QueryOrPipeline queryOrPipeline, IndexOffset offset, @Nullable QueryContext context) {
403-
RealtimePipeline pipeline = queryOrPipeline.pipeline();
403+
RealtimePipeline pipeline = queryOrPipeline.pipeline$com_google_firebase_firebase_firestore();
404404
if (getPipelineSourceType(pipeline) == PipelineSourceType.COLLECTION_GROUP) {
405405
String collectionGroup = getPipelineCollectionGroup(pipeline);
406406
hardAssert(

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ com.google.firebase.firestore.proto.Target encodeTargetData(TargetData targetDat
234234
com.google.firestore.v1.Target.PipelineQueryTarget.newBuilder()
235235
.setStructuredPipeline(
236236
target
237-
.pipeline()
237+
.pipeline$com_google_firebase_firebase_firestore()
238238
.toStructurePipelineProto$com_google_firebase_firebase_firestore()));
239239
}
240240

firebase-firestore/src/main/java/com/google/firebase/firestore/local/MemoryRemoteDocumentCache.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ public Map<DocumentKey, MutableDocument> getDocumentsMatchingQuery(
112112
if (query.isQuery()) {
113113
path = query.query().getPath();
114114
} else {
115-
path = ResourcePath.fromString(getPipelineCollection(query.pipeline()));
115+
path =
116+
ResourcePath.fromString(
117+
getPipelineCollection(query.pipeline$com_google_firebase_firebase_firestore()));
116118
}
117119
DocumentKey prefix = DocumentKey.fromPath(path.append(""));
118120
Iterator<Map.Entry<DocumentKey, Document>> iterator = docs.iteratorFrom(prefix);

0 commit comments

Comments
 (0)