Skip to content

Merge LRU tracking PRs #1285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions packages/firestore/src/core/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

import { CredentialsProvider } from '../api/credentials';
import { User } from '../auth/user';
import { EagerGarbageCollector } from '../local/eager_garbage_collector';
import { GarbageCollector } from '../local/garbage_collector';
import { IndexedDbPersistence } from '../local/indexeddb_persistence';
import { LocalStore } from '../local/local_store';
import { MemoryPersistence } from '../local/memory_persistence';
import { NoOpGarbageCollector } from '../local/no_op_garbage_collector';
import { Persistence } from '../local/persistence';
import {
DocumentKeySet,
Expand Down Expand Up @@ -83,7 +80,6 @@ export class FirestoreClient {
// with the types rather than littering the code with '!' or unnecessary
// undefined checks.
private eventMgr: EventManager;
private garbageCollector: GarbageCollector;
private persistence: Persistence;
private localStore: LocalStore;
private remoteStore: RemoteStore;
Expand Down Expand Up @@ -292,7 +288,6 @@ export class FirestoreClient {

// TODO(http://b/33384523): For now we just disable garbage collection
// when persistence is enabled.
this.garbageCollector = new NoOpGarbageCollector();
const storagePrefix = IndexedDbPersistence.buildStoragePrefix(
this.databaseInfo
);
Expand Down Expand Up @@ -347,8 +342,7 @@ export class FirestoreClient {
* @returns A promise that will successfully resolve.
*/
private startMemoryPersistence(): Promise<void> {
this.garbageCollector = new EagerGarbageCollector();
this.persistence = new MemoryPersistence(this.clientId);
this.persistence = MemoryPersistence.createEagerPersistence(this.clientId);
this.sharedClientState = new MemorySharedClientState();
return Promise.resolve();
}
Expand All @@ -363,11 +357,7 @@ export class FirestoreClient {
return this.platform
.loadConnection(this.databaseInfo)
.then(async connection => {
this.localStore = new LocalStore(
this.persistence,
user,
this.garbageCollector
);
this.localStore = new LocalStore(this.persistence, user);
const serializer = this.platform.newSerializer(
this.databaseInfo.databaseId
);
Expand Down
9 changes: 1 addition & 8 deletions packages/firestore/src/core/sync_engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
this.remoteStore.unlisten(queryView.targetId);
return this.removeAndCleanupQuery(queryView);
})
.then(() => this.localStore.collectGarbage())
.catch(err => this.ignoreIfPrimaryLeaseLoss(err));
}
} else {
Expand Down Expand Up @@ -583,7 +582,6 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
// NOTE: Both these methods are no-ops for batches that originated from
// other clients.
this.processUserCallback(batchId, error ? error : null);

this.localStore.removeCachedMutationBatchMetadata(batchId);
} else {
fail(`Unknown batchState: ${batchState}`);
Expand Down Expand Up @@ -820,12 +818,7 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {

await Promise.all(queriesProcessed);
this.syncEngineListener!.onWatchChange(newSnaps);
this.localStore.notifyLocalViewChanges(docChangesInAllViews);
if (this.isPrimary) {
await this.localStore
.collectGarbage()
.catch(err => this.ignoreIfPrimaryLeaseLoss(err));
}
await this.localStore.notifyLocalViewChanges(docChangesInAllViews);
}

/**
Expand Down
103 changes: 0 additions & 103 deletions packages/firestore/src/local/eager_garbage_collector.ts

This file was deleted.

79 changes: 0 additions & 79 deletions packages/firestore/src/local/garbage_collector.ts

This file was deleted.

48 changes: 0 additions & 48 deletions packages/firestore/src/local/garbage_source.ts

This file was deleted.

Loading