@@ -2,7 +2,6 @@ import * as messages from "./pure/messages-shared";
22import * as legacyMessages from "./pure/legacy-messages" ;
33import { DatabaseInfo , QueryMetadata } from "./pure/interface-types" ;
44import { join , parse , dirname , basename } from "path" ;
5- import { createTimestampFile } from "./helpers" ;
65import {
76 ConfigurationTarget ,
87 Range ,
@@ -19,6 +18,8 @@ import {
1918 createWriteStream ,
2019 remove ,
2120 readdir ,
21+ ensureDir ,
22+ writeFile ,
2223} from "fs-extra" ;
2324import { ensureMetadataIsComplete , InitialQueryInfo } from "./query-results" ;
2425import { isQuickQueryPath } from "./local-queries" ;
@@ -160,14 +161,6 @@ export class QueryEvaluationInfo extends QueryOutputDir {
160161 return join ( this . querySaveDir , `sortedResults-${ resultSetName } .bqrs` ) ;
161162 }
162163
163- /**
164- * Creates a file in the query directory that indicates when this query was created.
165- * This is important for keeping track of when queries should be removed.
166- */
167- async createTimestampFile ( ) {
168- await createTimestampFile ( this . querySaveDir ) ;
169- }
170-
171164 /**
172165 * Holds if this query can in principle produce interpreted results.
173166 */
@@ -693,3 +686,16 @@ export async function logEndSummary(
693686 ) ;
694687 }
695688}
689+
690+ /**
691+ * Creates a file in the query directory that indicates when this query was created.
692+ * This is important for keeping track of when queries should be removed.
693+ *
694+ * @param storagePath The directory that will contain all files relevant to a query result.
695+ * It does not need to exist.
696+ */
697+ export async function createTimestampFile ( storagePath : string ) {
698+ const timestampPath = join ( storagePath , "timestamp" ) ;
699+ await ensureDir ( storagePath ) ;
700+ await writeFile ( timestampPath , Date . now ( ) . toString ( ) , "utf8" ) ;
701+ }
0 commit comments