Deploys filesystem datastore for metadata.

This commit is contained in:
Ben 2024-04-29 13:12:21 +02:00
parent 9365aa4d51
commit 336c4589b9
No known key found for this signature in database
GPG Key ID: 541B9D8C9F1426A1
3 changed files with 15 additions and 2 deletions

View File

@ -67,6 +67,9 @@ when isMainModule:
# permissions are insecure.
quit QuitFailure
if not(checkAndCreateDataDir((config.metaDir).string)):
quit QuitFailure
trace "Data dir initialized", dir = $config.dataDir
if not(checkAndCreateDataDir((config.dataDir / "repo"))):

View File

@ -252,10 +252,12 @@ proc new*(
of repoSQLite: Datastore(SQLiteDatastore.new($config.dataDir)
.expect("Should create repo SQLite data store!"))
metadataStore = Datastore(FSDatastore.new($config.metaDir, depth = 5)
.expect("Should create repo metadata store!"))
repoStore = RepoStore.new(
repoDs = repoData,
metaDs = SQLiteDatastore.new(config.dataDir / CodexMetaNamespace)
.expect("Should create meta data store!"),
metaDs = metadataStore,
quotaMaxBytes = config.storageQuota.uint,
blockTtl = config.blockTtl)

View File

@ -62,6 +62,7 @@ const
codex_enable_log_counter* {.booldefine.} = false
DefaultDataDir* = defaultDataDir()
DefaultMetaDataDir* = defaultDataDir() / "metadata"
type
StartUpCmd* {.pure.} = enum
@ -125,6 +126,13 @@ type
abbr: "d"
name: "data-dir" }: OutDir
metaDir* {.
desc: "The directory where codex will store metadata"
defaultValue: DefaultMetaDataDir
defaultValueDesc: $DefaultMetaDataDir
abbr: "md"
name: "meta-dir" }: OutDir
listenAddrs* {.
desc: "Multi Addresses to listen on"
defaultValue: @[