Search in sources :

Example 1 with MemoryComponentProvider

use of com.google.firebase.firestore.core.MemoryComponentProvider 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)

Aggregations

MemoryComponentProvider (com.google.firebase.firestore.core.MemoryComponentProvider)1 LocalSerializer (com.google.firebase.firestore.local.LocalSerializer)1 DatabaseId (com.google.firebase.firestore.model.DatabaseId)1 RemoteSerializer (com.google.firebase.firestore.remote.RemoteSerializer)1