Skip to content

Commit 01a8945

Browse files
Add bundle package (#2332)
1 parent 90d4c35 commit 01a8945

File tree

14 files changed

+43
-86
lines changed

14 files changed

+43
-86
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/BundleMetadata.java renamed to firebase-firestore/src/main/java/com/google/firebase/firestore/bundle/BundleMetadata.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.firestore.local;
15+
package com.google.firebase.firestore.bundle;
1616

1717
import com.google.firebase.firestore.model.SnapshotVersion;
1818

1919
/** Represents a Firestore bundle saved by the SDK in its local storage. */
20-
/* package */ class BundleMetadata {
20+
public class BundleMetadata {
2121
private final String bundleId;
2222
private final int version;
2323
private final SnapshotVersion createTime;

firebase-firestore/src/main/java/com/google/firebase/firestore/local/BundleSerializer.java renamed to firebase-firestore/src/main/java/com/google/firebase/firestore/bundle/BundleSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.firestore.local;
15+
package com.google.firebase.firestore.bundle;
1616

1717
import android.util.Base64;
1818
import androidx.annotation.Nullable;

firebase-firestore/src/main/java/com/google/firebase/firestore/local/BundledDocumentMetadata.java renamed to firebase-firestore/src/main/java/com/google/firebase/firestore/bundle/BundledDocumentMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.firestore.local;
15+
package com.google.firebase.firestore.bundle;
1616

1717
import com.google.firebase.firestore.model.DocumentKey;
1818
import com.google.firebase.firestore.model.SnapshotVersion;

firebase-firestore/src/main/java/com/google/firebase/firestore/local/BundledQuery.java renamed to firebase-firestore/src/main/java/com/google/firebase/firestore/bundle/BundledQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.firestore.local;
15+
package com.google.firebase.firestore.bundle;
1616

1717
import com.google.firebase.firestore.core.Query;
1818
import com.google.firebase.firestore.core.Target;

firebase-firestore/src/main/java/com/google/firebase/firestore/local/NamedQuery.java renamed to firebase-firestore/src/main/java/com/google/firebase/firestore/bundle/NamedQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.firestore.local;
15+
package com.google.firebase.firestore.bundle;
1616

1717
import com.google.firebase.firestore.model.SnapshotVersion;
1818

1919
/** Represents a named query saved by the SDK in its local storage. */
20-
/* package */ class NamedQuery {
20+
public class NamedQuery {
2121
private final String name;
2222
private final BundledQuery bundledQuery;
2323
private final SnapshotVersion readTime;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2021 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+
/** @hide */
16+
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
17+
package com.google.firebase.firestore.bundle;
18+
19+
import androidx.annotation.RestrictTo;

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

Lines changed: 0 additions & 71 deletions
This file was deleted.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
package com.google.firebase.firestore.local;
1616

1717
import androidx.annotation.Nullable;
18+
import com.google.firebase.firestore.bundle.BundleMetadata;
19+
import com.google.firebase.firestore.bundle.NamedQuery;
1820

1921
/** Provides methods to save and read Firestore bundles. */
2022
public interface BundleCache {

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,12 @@ TargetData decodeTargetData(com.google.firebase.firestore.proto.Target targetPro
269269
resumeToken);
270270
}
271271

272-
public com.google.firestore.proto.BundledQuery encodeBundledQuery(
273-
com.google.firebase.firestore.local.BundledQuery bundledQuery) {
272+
public BundledQuery encodeBundledQuery(
273+
com.google.firebase.firestore.bundle.BundledQuery bundledQuery) {
274274
com.google.firestore.v1.Target.QueryTarget queryTarget =
275275
rpcSerializer.encodeQueryTarget(bundledQuery.getTarget());
276276

277-
com.google.firestore.proto.BundledQuery.Builder result =
278-
com.google.firestore.proto.BundledQuery.newBuilder();
277+
BundledQuery.Builder result = BundledQuery.newBuilder();
279278
result.setLimitType(
280279
bundledQuery.getLimitType().equals(LimitType.LIMIT_TO_FIRST)
281280
? BundledQuery.LimitType.FIRST
@@ -286,8 +285,8 @@ public com.google.firestore.proto.BundledQuery encodeBundledQuery(
286285
return result.build();
287286
}
288287

289-
public com.google.firebase.firestore.local.BundledQuery decodeBundledQuery(
290-
com.google.firestore.proto.BundledQuery bundledQuery) {
288+
public com.google.firebase.firestore.bundle.BundledQuery decodeBundledQuery(
289+
BundledQuery bundledQuery) {
291290
LimitType limitType =
292291
bundledQuery.getLimitType().equals(BundledQuery.LimitType.FIRST)
293292
? LimitType.LIMIT_TO_FIRST
@@ -296,6 +295,6 @@ public com.google.firebase.firestore.local.BundledQuery decodeBundledQuery(
296295
rpcSerializer.decodeQueryTarget(
297296
bundledQuery.getParent(), bundledQuery.getStructuredQuery());
298297

299-
return new com.google.firebase.firestore.local.BundledQuery(target, limitType);
298+
return new com.google.firebase.firestore.bundle.BundledQuery(target, limitType);
300299
}
301300
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
package com.google.firebase.firestore.local;
1616

1717
import androidx.annotation.Nullable;
18+
import com.google.firebase.firestore.bundle.BundleMetadata;
19+
import com.google.firebase.firestore.bundle.NamedQuery;
1820
import java.util.HashMap;
1921
import java.util.Map;
2022

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import androidx.annotation.Nullable;
2020
import com.google.firebase.Timestamp;
21+
import com.google.firebase.firestore.bundle.BundleMetadata;
22+
import com.google.firebase.firestore.bundle.NamedQuery;
2123
import com.google.firebase.firestore.model.SnapshotVersion;
2224
import com.google.firestore.proto.BundledQuery;
2325
import com.google.protobuf.InvalidProtocolBufferException;

firebase-firestore/src/test/java/com/google/firebase/firestore/local/BundleSerializerTest.java renamed to firebase-firestore/src/test/java/com/google/firebase/firestore/bundle/BundleSerializerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.firestore.local;
15+
package com.google.firebase.firestore.bundle;
1616

1717
import static com.google.firebase.firestore.testutil.TestUtil.filter;
1818
import static com.google.firebase.firestore.testutil.TestUtil.key;

firebase-firestore/src/test/java/com/google/firebase/firestore/local/BundleCacheTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import static org.junit.Assert.assertNull;
2020

2121
import com.google.firebase.Timestamp;
22+
import com.google.firebase.firestore.bundle.BundleMetadata;
23+
import com.google.firebase.firestore.bundle.BundledQuery;
24+
import com.google.firebase.firestore.bundle.NamedQuery;
2225
import com.google.firebase.firestore.core.Query;
2326
import com.google.firebase.firestore.core.Target;
2427
import com.google.firebase.firestore.model.ResourcePath;

firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalSerializerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import static org.junit.Assert.assertTrue;
3131

3232
import com.google.firebase.Timestamp;
33+
import com.google.firebase.firestore.bundle.BundledQuery;
3334
import com.google.firebase.firestore.core.Query;
3435
import com.google.firebase.firestore.core.Target;
3536
import com.google.firebase.firestore.model.DatabaseId;

0 commit comments

Comments
 (0)