@typeberry/convert 0.9.0-6850f84 → 0.9.0-a723180
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.
- package/index.js +25 -3
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -11527,6 +11527,13 @@ var KnownChainSpec;
|
|
|
11527
11527
|
/** Full chain spec. */
|
|
11528
11528
|
KnownChainSpec["Full"] = "full";
|
|
11529
11529
|
})(KnownChainSpec || (KnownChainSpec = {}));
|
|
11530
|
+
/** Persistent regular-node database backend. */
|
|
11531
|
+
var RegularStateBackend;
|
|
11532
|
+
(function (RegularStateBackend) {
|
|
11533
|
+
/** @deprecated lmdb remains available as an explicit fallback, but fjall is the default backend. */
|
|
11534
|
+
RegularStateBackend["Lmdb"] = "lmdb";
|
|
11535
|
+
RegularStateBackend["Fjall"] = "fjall";
|
|
11536
|
+
})(RegularStateBackend || (RegularStateBackend = {}));
|
|
11530
11537
|
const knownChainSpecFromJson = json.fromString((input, ctx) => {
|
|
11531
11538
|
switch (input) {
|
|
11532
11539
|
case KnownChainSpec.Tiny:
|
|
@@ -11537,12 +11544,23 @@ const knownChainSpecFromJson = json.fromString((input, ctx) => {
|
|
|
11537
11544
|
throw Error(`unknown network flavor: ${input} at ${ctx}`);
|
|
11538
11545
|
}
|
|
11539
11546
|
});
|
|
11547
|
+
const regularStateBackendFromJson = json.fromString((input, ctx) => {
|
|
11548
|
+
switch (input) {
|
|
11549
|
+
case RegularStateBackend.Lmdb:
|
|
11550
|
+
return RegularStateBackend.Lmdb;
|
|
11551
|
+
case RegularStateBackend.Fjall:
|
|
11552
|
+
return RegularStateBackend.Fjall;
|
|
11553
|
+
default:
|
|
11554
|
+
throw Error(`unknown state backend: ${input} at ${ctx}`);
|
|
11555
|
+
}
|
|
11556
|
+
});
|
|
11540
11557
|
class NodeConfiguration {
|
|
11541
11558
|
$schema;
|
|
11542
11559
|
version;
|
|
11543
11560
|
flavor;
|
|
11544
11561
|
chainSpec;
|
|
11545
11562
|
databaseBasePath;
|
|
11563
|
+
stateBackend;
|
|
11546
11564
|
authorship;
|
|
11547
11565
|
static fromJson = json.object({
|
|
11548
11566
|
$schema: "string",
|
|
@@ -11550,22 +11568,26 @@ class NodeConfiguration {
|
|
|
11550
11568
|
flavor: knownChainSpecFromJson,
|
|
11551
11569
|
chain_spec: JipChainSpec.fromJson,
|
|
11552
11570
|
database_base_path: json.optional("string"),
|
|
11571
|
+
state_backend: json.optional(regularStateBackendFromJson),
|
|
11553
11572
|
authorship: AuthorshipOptions.fromJson,
|
|
11554
11573
|
}, NodeConfiguration.new);
|
|
11555
|
-
static new({ $schema, version, flavor, chain_spec, database_base_path, authorship }) {
|
|
11574
|
+
static new({ $schema, version, flavor, chain_spec, database_base_path, state_backend, authorship, }) {
|
|
11556
11575
|
if (version !== 1) {
|
|
11557
11576
|
throw new Error("Only version=1 config is supported.");
|
|
11558
11577
|
}
|
|
11559
|
-
return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, authorship);
|
|
11578
|
+
return new NodeConfiguration($schema, version, flavor, chain_spec, database_base_path ?? undefined, state_backend ?? RegularStateBackend.Fjall, authorship);
|
|
11560
11579
|
}
|
|
11561
11580
|
constructor($schema, version, flavor, chainSpec,
|
|
11562
11581
|
/** If database path is not provided, we load an in-memory db. */
|
|
11563
|
-
databaseBasePath,
|
|
11582
|
+
databaseBasePath,
|
|
11583
|
+
/** Persistent database backend used when `databaseBasePath` is set. */
|
|
11584
|
+
stateBackend, authorship) {
|
|
11564
11585
|
this.$schema = $schema;
|
|
11565
11586
|
this.version = version;
|
|
11566
11587
|
this.flavor = flavor;
|
|
11567
11588
|
this.chainSpec = chainSpec;
|
|
11568
11589
|
this.databaseBasePath = databaseBasePath;
|
|
11590
|
+
this.stateBackend = stateBackend;
|
|
11569
11591
|
this.authorship = authorship;
|
|
11570
11592
|
}
|
|
11571
11593
|
}
|