diff --git a/init.go b/init.go index 448fffa73c1b32e4d7bf0c9f02e0f0f6f07bfe28..32d5a1f222b2fc768a30356fc0fecd2233ae2834 100644 --- a/init.go +++ b/init.go @@ -142,6 +142,19 @@ func badgerSpec() map[string]interface{} { } } +func badger2Spec() map[string]interface{} { + return map[string]interface{}{ + "type": "measure", + "prefix": "badger2.datastore", + "child": map[string]interface{}{ + "type": "badger2ds", + "path": "badger2ds", + "syncWrites": false, + "truncate": true, + }, + } +} + func flatfsSpec() map[string]interface{} { return map[string]interface{}{ "type": "mount", diff --git a/profile.go b/profile.go index 697ca305aea15bb87536c5fb9c0ccd92ec9a4fe1..ba1013316293ee53c5e5451320e578345c7c6c2e 100644 --- a/profile.go +++ b/profile.go @@ -130,7 +130,7 @@ This profile may only be applied when first initializing the node. This is the most battle-tested and reliable datastore, but it's significantly slower than the badger datastore. You should use this datastore if: -* You need a very simple and very reliable datastore you and trust your +* You need a very simple and very reliable datastore and you trust your filesystem. This datastore stores each block as a separate file in the underlying filesystem so it's unlikely to loose data unless there's an issue with the underlying file system. @@ -152,7 +152,7 @@ This profile may only be applied when first initializing the node. "badgerds": { Description: `Configures the node to use the badger datastore. -This is the fastest datastore. Use this datastore if performance, especially +This is a fast datastore. Use this datastore if performance, especially when adding many gigabytes of files, is critical. However: * This datastore will not properly reclaim space when your datastore is @@ -170,6 +170,27 @@ This profile may only be applied when first initializing the node.`, return nil }, }, + "badger2ds": { + Description: `Configures the node to use the badger2 datastore. + +This is the fastest datastore. Use this datastore if performance, especially +when adding many gigabytes of files, is critical. However: + +* This datastore will not properly reclaim space when your datastore is + smaller than several gigabytes. If you run IPFS with '--enable-gc' (you have + enabled block-level garbage collection), you plan on storing very little data in + your IPFS node, and disk usage is more critical than performance, consider using + flatfs. +* This datastore uses up to several gigabytes of memory. + +This profile may only be applied when first initializing the node.`, + + InitOnly: true, + Transform: func(c *Config) error { + c.Datastore.Spec = badger2Spec() + return nil + }, + }, "lowpower": { Description: `Reduces daemon overhead on the system. May affect node functionality - performance of content discovery and data