use of com.google.firebase.firestore.remote.RemoteSerializer in project firebase-android-sdk by firebase.
the class MemorySpecTest method initializeComponentProvider.
@Override
protected MemoryComponentProvider initializeComponentProvider(ComponentProvider.Configuration configuration, boolean garbageCollectionEnabled) {
MemoryComponentProvider provider = new MemoryComponentProvider() {
@Override
protected Persistence createPersistence(Configuration configuration) {
if (garbageCollectionEnabled) {
return MemoryPersistence.createEagerGcMemoryPersistence();
} else {
DatabaseId databaseId = DatabaseId.forProject("projectId");
LocalSerializer serializer = new LocalSerializer(new RemoteSerializer(databaseId));
return MemoryPersistence.createLruGcMemoryPersistence(LruGarbageCollector.Params.Default(), serializer);
}
}
};
provider.initialize(configuration);
return provider;
}
use of com.google.firebase.firestore.remote.RemoteSerializer in project firebase-android-sdk by firebase.
the class PersistenceTestHelpers method createLRUMemoryPersistence.
public static MemoryPersistence createLRUMemoryPersistence(LruGarbageCollector.Params params) {
DatabaseId databaseId = DatabaseId.forProject("projectId");
LocalSerializer serializer = new LocalSerializer(new RemoteSerializer(databaseId));
MemoryPersistence persistence = MemoryPersistence.createLruGcMemoryPersistence(params, serializer);
persistence.start();
return persistence;
}
use of com.google.firebase.firestore.remote.RemoteSerializer in project firebase-android-sdk by firebase.
the class SQLiteComponentProvider method createPersistence.
@Override
protected Persistence createPersistence(Configuration configuration) {
LocalSerializer serializer = new LocalSerializer(new RemoteSerializer(configuration.getDatabaseInfo().getDatabaseId()));
LruGarbageCollector.Params params = LruGarbageCollector.Params.WithCacheSizeBytes(configuration.getSettings().getCacheSizeBytes());
return new SQLitePersistence(configuration.getContext(), configuration.getDatabaseInfo().getPersistenceKey(), configuration.getDatabaseInfo().getDatabaseId(), serializer, params);
}
use of com.google.firebase.firestore.remote.RemoteSerializer in project firebase-android-sdk by firebase.
the class PersistenceTestHelpers method openSQLitePersistence.
private static SQLitePersistence openSQLitePersistence(int version, String name, LruGarbageCollector.Params params) {
DatabaseId databaseId = DatabaseId.forProject("projectId");
LocalSerializer serializer = new LocalSerializer(new RemoteSerializer(databaseId));
Context context = ApplicationProvider.getApplicationContext();
SQLitePersistence persistence = new SQLitePersistence(serializer, params, new SQLitePersistence.OpenHelper(context, serializer, databaseName(name, databaseId), version));
persistence.start();
return persistence;
}
use of com.google.firebase.firestore.remote.RemoteSerializer in project firebase-android-sdk by firebase.
the class PersistenceTestHelpers method openSQLitePersistence.
private static SQLitePersistence openSQLitePersistence(String name, LruGarbageCollector.Params params) {
DatabaseId databaseId = DatabaseId.forProject("projectId");
LocalSerializer serializer = new LocalSerializer(new RemoteSerializer(databaseId));
Context context = ApplicationProvider.getApplicationContext();
SQLitePersistence persistence = new SQLitePersistence(context, name, databaseId, serializer, params);
persistence.start();
return persistence;
}
Aggregations