@dignetwork/dig-sdk 0.0.1-alpha.59 → 0.0.1-alpha.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,6 +44,7 @@ export declare class DataStore {
|
|
|
44
44
|
}>;
|
|
45
45
|
private setCreationHeight;
|
|
46
46
|
getRootHistory(): Promise<RootHistoryItem[]>;
|
|
47
|
+
generateManifestFile(): Promise<void>;
|
|
47
48
|
getMetaData(): Promise<DataStoreMetadata>;
|
|
48
49
|
isSynced(): Promise<boolean>;
|
|
49
50
|
hasMetaWritePermissions(publicSyntheticKey?: Buffer): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataStore.d.ts","sourceRoot":"","sources":["../../src/blockchain/DataStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,SAAS,IAAI,eAAe,EAE5B,iBAAiB,EAIlB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAGpD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAYjD,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAAoB;gBAEpB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;
|
|
1
|
+
{"version":3,"file":"DataStore.d.ts","sourceRoot":"","sources":["../../src/blockchain/DataStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,SAAS,IAAI,eAAe,EAE5B,iBAAiB,EAIlB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAGpD,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,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AC1B,OAAO,CAAC,OAAO,CAAC;IAkBN,cAAc,CACzB,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,eAAe,CAAC;IA+C3B;;;;;OAKG;IACU,qBAAqB,CAChC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAsD7C"}
|
|
@@ -26,9 +26,6 @@ const readdir = (0, util_1.promisify)(fs_1.default.readdir);
|
|
|
26
26
|
class DataStore {
|
|
27
27
|
constructor(storeId, options) {
|
|
28
28
|
this.storeId = storeId;
|
|
29
|
-
// This will create the manifest file if it doesn't exist
|
|
30
|
-
// might be a hacky way to do this, but it works for now
|
|
31
|
-
this.getRootHistory();
|
|
32
29
|
let _options;
|
|
33
30
|
if (options) {
|
|
34
31
|
_options = options;
|
|
@@ -310,12 +307,17 @@ class DataStore {
|
|
|
310
307
|
}));
|
|
311
308
|
// Store the root history in the cache
|
|
312
309
|
rootHistoryCache.set(this.storeId, rootHistory);
|
|
310
|
+
return rootHistory;
|
|
311
|
+
}
|
|
312
|
+
// Generates a fresh manifest file based on the current root history
|
|
313
|
+
// and what is currently on disk
|
|
314
|
+
async generateManifestFile() {
|
|
315
|
+
const rootHistory = await this.getRootHistory();
|
|
313
316
|
// Need this for the dataintegrity tree to work properly
|
|
314
317
|
fs_1.default.writeFileSync(path_1.default.join(config_1.STORE_PATH, this.storeId, "manifest.dat"), rootHistory
|
|
315
318
|
.filter((root) => root.synced)
|
|
316
319
|
.map((root) => root.root_hash)
|
|
317
320
|
.join("\n"));
|
|
318
|
-
return rootHistory;
|
|
319
321
|
}
|
|
320
322
|
async getMetaData() {
|
|
321
323
|
const { latestStore } = await this.fetchCoinInfo();
|