Skip to content

Commit

Permalink
REmoving unnecessary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
trollboss2572 committed Nov 29, 2024
1 parent 6751cf4 commit 58b52ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
25 changes: 2 additions & 23 deletions libs/checkpoint-firebase/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,6 @@ export class FirebaseSaver extends BaseCheckpointSaver {
"Failed to serialized checkpoint and metadata to the same type."
);
}

/* We want to store the following (taken from MongoDB implementation)
- checkpoint ID
- checkpoint type
- checkpoint (serialized)
- metadata (serialized)*/

/* SQLite implementation also stores the following
- parent checkpoint ID
- thread ID,
- checkpoint_ns, */

/* I believe the excess values are stored for debugging purposes (hunch)
I am going to store the excess values as well here */

const data = {
thread_id: thread_id,
checkpoint_ns: checkpoint_ns,
Expand All @@ -253,15 +238,11 @@ export class FirebaseSaver extends BaseCheckpointSaver {
metadata: serializedMetadata
};

/* "thread_id", "checkpoint_ns", and "checkpoint_id"
form the "primary key" for this database */
const docKey = `${thread_id}_${checkpoint_ns}_${checkpoint.id}`;

/* Get a reference to the location in the database
where you want to store the data */

const dataRef = ref(this.db, `${this.checkpointCollectionName}/${docKey}`);

/* Use set to write the data to this reference */
await set(dataRef, data);

return {
Expand All @@ -273,7 +254,6 @@ export class FirebaseSaver extends BaseCheckpointSaver {
};
}

/* Saves intermediate writes associated with a checkpoint to the Firestore database. */
async putWrites(
config: RunnableConfig,
writes: PendingWrite[],
Expand Down Expand Up @@ -302,8 +282,7 @@ export class FirebaseSaver extends BaseCheckpointSaver {
const [channel, value] = write;
const [type, serializedValue] = this.serde.dumpsTyped(value);

/* "thread_id", "checkpoint_ns", "checkpoint_id", "taskId" and "idx"
form the "primary key" for each checkpoint write */

const writeKey = `${thread_id}_${checkpoint_ns}_${checkpoint_id}_${taskId}_${idx}`;

currentData[writeKey] = {
Expand Down
19 changes: 0 additions & 19 deletions libs/checkpoint-firebase/src/tests/checkpoints.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@ const app = initializeApp({
const database = getDatabase(app);
let saver = new FirebaseSaver(database);


// beforeAll(async () => {
// const databaseUrl = process.env.FIREBASE_URL;
// if (!databaseUrl) {
// throw new Error("FIREBASE_URL environment variable is not set.");
// }

// // Initialize Firebase SDK
// const app = initializeApp({
// apiKey: "emulator-api-key",
// authDomain: "localhost",
// projectId: "test-project",
// databaseURL: databaseUrl,
// });

// database = getDatabase(app); // Access the database
// saver = new FirebaseSaver(database); // Create a new FirebaseSaver instance
// });

afterAll(async () => {
await clearCollection(database, "checkpoints");
await clearCollection(database, "checkpoint-writes");
Expand Down

0 comments on commit 58b52ed

Please sign in to comment.