Search in sources :

Example 1 with RemoteSerializer

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;
}
Also used : RemoteSerializer(com.google.firebase.firestore.remote.RemoteSerializer) MemoryComponentProvider(com.google.firebase.firestore.core.MemoryComponentProvider) DatabaseId(com.google.firebase.firestore.model.DatabaseId) LocalSerializer(com.google.firebase.firestore.local.LocalSerializer)

Example 2 with RemoteSerializer

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;
}
Also used : RemoteSerializer(com.google.firebase.firestore.remote.RemoteSerializer) DatabaseId(com.google.firebase.firestore.model.DatabaseId)

Example 3 with RemoteSerializer

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);
}
Also used : LruGarbageCollector(com.google.firebase.firestore.local.LruGarbageCollector) RemoteSerializer(com.google.firebase.firestore.remote.RemoteSerializer) SQLitePersistence(com.google.firebase.firestore.local.SQLitePersistence) LocalSerializer(com.google.firebase.firestore.local.LocalSerializer)

Example 4 with RemoteSerializer

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;
}
Also used : Context(android.content.Context) RemoteSerializer(com.google.firebase.firestore.remote.RemoteSerializer) DatabaseId(com.google.firebase.firestore.model.DatabaseId)

Example 5 with RemoteSerializer

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;
}
Also used : Context(android.content.Context) RemoteSerializer(com.google.firebase.firestore.remote.RemoteSerializer) DatabaseId(com.google.firebase.firestore.model.DatabaseId)

Aggregations

RemoteSerializer (com.google.firebase.firestore.remote.RemoteSerializer)7 DatabaseId (com.google.firebase.firestore.model.DatabaseId)5 Context (android.content.Context)2 LocalSerializer (com.google.firebase.firestore.local.LocalSerializer)2 LoadBundleTask (com.google.firebase.firestore.LoadBundleTask)1 BundleReader (com.google.firebase.firestore.bundle.BundleReader)1 BundleSerializer (com.google.firebase.firestore.bundle.BundleSerializer)1 MemoryComponentProvider (com.google.firebase.firestore.core.MemoryComponentProvider)1 LruGarbageCollector (com.google.firebase.firestore.local.LruGarbageCollector)1 SQLitePersistence (com.google.firebase.firestore.local.SQLitePersistence)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Before (org.junit.Before)1