what-the-bank/sources/com/google/firebase/firestore/model/mutation/MutationBatchResult.java

58 lines
2.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.firestore.model.mutation;
import com.google.firebase.database.collection.ImmutableSortedMap;
import com.google.firebase.firestore.model.DocumentCollections;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.SnapshotVersion;
import com.google.firebase.firestore.util.Assert;
import java.util.List;
import o.QwV;
/* loaded from: classes2.dex */
public final class MutationBatchResult {
private final MutationBatch batch;
private final SnapshotVersion commitVersion;
private final ImmutableSortedMap<DocumentKey, SnapshotVersion> docVersions;
private final List<MutationResult> mutationResults;
private final QwV streamToken;
private MutationBatchResult(MutationBatch mutationBatch, SnapshotVersion snapshotVersion, List<MutationResult> list, QwV qwV, ImmutableSortedMap<DocumentKey, SnapshotVersion> immutableSortedMap) {
this.batch = mutationBatch;
this.commitVersion = snapshotVersion;
this.mutationResults = list;
this.streamToken = qwV;
this.docVersions = immutableSortedMap;
}
public static MutationBatchResult create(MutationBatch mutationBatch, SnapshotVersion snapshotVersion, List<MutationResult> list, QwV qwV) {
Assert.hardAssert(mutationBatch.getMutations().size() == list.size(), "Mutations sent %d must equal results received %d", Integer.valueOf(mutationBatch.getMutations().size()), Integer.valueOf(list.size()));
ImmutableSortedMap<DocumentKey, SnapshotVersion> emptyVersionMap = DocumentCollections.emptyVersionMap();
List<Mutation> mutations = mutationBatch.getMutations();
ImmutableSortedMap<DocumentKey, SnapshotVersion> immutableSortedMap = emptyVersionMap;
for (int i = 0; i < mutations.size(); i++) {
immutableSortedMap = immutableSortedMap.insert(mutations.get(i).getKey(), list.get(i).getVersion());
}
return new MutationBatchResult(mutationBatch, snapshotVersion, list, qwV, immutableSortedMap);
}
public final QwV getStreamToken() {
return this.streamToken;
}
public final List<MutationResult> getMutationResults() {
return this.mutationResults;
}
public final ImmutableSortedMap<DocumentKey, SnapshotVersion> getDocVersions() {
return this.docVersions;
}
public final SnapshotVersion getCommitVersion() {
return this.commitVersion;
}
public final MutationBatch getBatch() {
return this.batch;
}
}