Resuscitate https://github.com/status-im/nim-codex/pull/251 except for (#358)
A) renaming to --repo-kind which makes more sense in the current code and B) without a working cacheStore (yet) Tagging related https://github.com/status-im/nim-codex/issues/357
This commit is contained in:
parent
98f6bb4ed9
commit
7cdd4f79e3
|
@ -54,6 +54,7 @@ The following options are available:
|
||||||
--max-peers The maximum number of peers to connect to [=160].
|
--max-peers The maximum number of peers to connect to [=160].
|
||||||
--agent-string Node agent string which is used as identifier in network [=Codex].
|
--agent-string Node agent string which is used as identifier in network [=Codex].
|
||||||
-p, --api-port The REST Api port [=8080].
|
-p, --api-port The REST Api port [=8080].
|
||||||
|
--repo-kind backend for main repo store (fs, sqlite) [=fs].
|
||||||
-q, --storage-quota The size of the total storage quota dedicated to the node [=8589934592].
|
-q, --storage-quota The size of the total storage quota dedicated to the node [=8589934592].
|
||||||
-t, --block-ttl Default block timeout in seconds - 0 disables the ttl [=86400].
|
-t, --block-ttl Default block timeout in seconds - 0 disables the ttl [=86400].
|
||||||
-c, --cache-size The size in MiB of the block cache, 0 disables the cache - might help on slow
|
-c, --cache-size The size in MiB of the block cache, 0 disables the cache - might help on slow
|
||||||
|
|
|
@ -158,9 +158,14 @@ proc new*(T: type CodexServer, config: CodexConf, privateKey: CodexPrivateKey):
|
||||||
wallet = WalletRef.new(EthPrivateKey.random())
|
wallet = WalletRef.new(EthPrivateKey.random())
|
||||||
network = BlockExcNetwork.new(switch)
|
network = BlockExcNetwork.new(switch)
|
||||||
|
|
||||||
|
repoData = case config.repoKind
|
||||||
|
of repoFS: Datastore(FSDatastore.new($config.dataDir, depth = 5)
|
||||||
|
.expect("Should create repo file data store!"))
|
||||||
|
of repoSQLite: Datastore(SQLiteDatastore.new($config.dataDir)
|
||||||
|
.expect("Should create repo SQLite data store!"))
|
||||||
|
|
||||||
repoStore = RepoStore.new(
|
repoStore = RepoStore.new(
|
||||||
repoDs = Datastore(FSDatastore.new($config.dataDir, depth = 5)
|
repoDs = repoData,
|
||||||
.expect("Should create repo data store!")),
|
|
||||||
metaDs = SQLiteDatastore.new(config.dataDir / CodexMetaNamespace)
|
metaDs = SQLiteDatastore.new(config.dataDir / CodexMetaNamespace)
|
||||||
.expect("Should create meta data store!"),
|
.expect("Should create meta data store!"),
|
||||||
quotaMaxBytes = config.storageQuota.uint,
|
quotaMaxBytes = config.storageQuota.uint,
|
||||||
|
|
|
@ -46,6 +46,10 @@ type
|
||||||
Json = "json"
|
Json = "json"
|
||||||
None = "none"
|
None = "none"
|
||||||
|
|
||||||
|
RepoKind* = enum
|
||||||
|
repoFS = "fs"
|
||||||
|
repoSQLite = "sqlite"
|
||||||
|
|
||||||
CodexConf* = object
|
CodexConf* = object
|
||||||
logLevel* {.
|
logLevel* {.
|
||||||
defaultValue: "INFO"
|
defaultValue: "INFO"
|
||||||
|
@ -151,6 +155,12 @@ type
|
||||||
name: "api-port"
|
name: "api-port"
|
||||||
abbr: "p" }: int
|
abbr: "p" }: int
|
||||||
|
|
||||||
|
repoKind* {.
|
||||||
|
desc: "backend for main repo store (fs, sqlite)"
|
||||||
|
defaultValueDesc: "fs"
|
||||||
|
defaultValue: repoFS
|
||||||
|
name: "repo-kind" }: RepoKind
|
||||||
|
|
||||||
storageQuota* {.
|
storageQuota* {.
|
||||||
desc: "The size of the total storage quota dedicated to the node"
|
desc: "The size of the total storage quota dedicated to the node"
|
||||||
defaultValue: DefaultQuotaBytes
|
defaultValue: DefaultQuotaBytes
|
||||||
|
|
Loading…
Reference in New Issue