moves consts to stores folder

This commit is contained in:
benbierens 2023-03-15 13:37:52 +01:00
parent 034473c84f
commit 41ae2abe62
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
9 changed files with 23 additions and 29 deletions

View File

@ -32,7 +32,7 @@ import pkg/ethers
import ./discovery
import ./stores
import ./consts
import ./stores/consts
export DefaultCacheSizeMiB, net, DefaultQuotaBytes, DefaultBlockTtl, DefaultBlockMaintenanceInterval, DefaultNumberOfBlocksToMaintainPerInterval, RepoKind

View File

@ -1,8 +0,0 @@
type
RepoKind* = enum
repoFS = "fs"
repoSQLite = "sqlite"
const
MiB* = 1024 * 1024

View File

@ -15,7 +15,7 @@ import pkg/confutils
import pkg/confutils/defs
import ../namespaces
import ../consts
import ./consts
import ./blockstore
import ./repostore
import ./cachestore

View File

@ -21,7 +21,7 @@ import pkg/questionable
import pkg/questionable/results
import ./blockstore
import ../consts
import ./consts
import ../chunker
import ../manifest
@ -35,10 +35,6 @@ type
backingStore: BlockStore
cache: LruCache[Cid, Block]
const
DefaultCacheSizeMiB* = 5
DefaultCacheSize* = DefaultCacheSizeMiB * MiB
method getBlock*(self: CacheStore, cid: Cid): Future[?!Block] {.async.} =
if cid.isEmpty:
trace "Empty block, ignoring"

17
codex/stores/consts.nim Normal file
View File

@ -0,0 +1,17 @@
import pkg/chronos
type
RepoKind* = enum
repoFS = "fs"
repoSQLite = "sqlite"
const
MiB* = 1024 * 1024
DefaultCacheSizeMiB* = 5
DefaultCacheSize* = DefaultCacheSizeMiB * MiB
DefaultBlockMaintenanceInterval* = 10.minutes
DefaultNumberOfBlocksToMaintainPerInterval* = 1000
DefaultMemoryStoreCapacityMiB* = 5
DefaultMemoryStoreCapacity* = DefaultMemoryStoreCapacityMiB * MiB
DefaultBlockTtl* = 24.hours
DefaultQuotaBytes* = 1'u shl 33'u # ~8GB

View File

@ -20,10 +20,6 @@ import ../utils/timer
import ../clock
import ../systemclock
const
DefaultBlockMaintenanceInterval* = 10.minutes
DefaultNumberOfBlocksToMaintainPerInterval* = 1000
type
BlockMaintainer* = ref object of RootObj
repoStore: RepoStore

View File

@ -22,7 +22,7 @@ import pkg/questionable
import pkg/questionable/results
import ./blockstore
import ../consts
import ./consts
import ../chunker
import ../manifest
@ -42,10 +42,6 @@ type
table: Table[Cid, DoublyLinkedNode[MemoryStoreNode]]
list: DoublyLinkedList[MemoryStoreNode]
const
DefaultMemoryStoreCapacityMiB* = 5
DefaultMemoryStoreCapacity* = DefaultMemoryStoreCapacityMiB * MiB
method getBlock*(self: MemoryStore, cid: Cid): Future[?!Block] {.async.} =
trace "Getting block from cache", cid
if cid.isEmpty:

View File

@ -21,6 +21,7 @@ import pkg/stew/endians2
import ./blockstore
import ./keyutils
import ./consts
import ../blocktype
import ../clock
import ../systemclock
@ -30,10 +31,6 @@ export blocktype, libp2p
logScope:
topics = "codex repostore"
const
DefaultBlockTtl* = 24.hours
DefaultQuotaBytes* = 1'u shl 33'u # ~8GB
type
QuotaUsedError* = object of CodexError
QuotaNotEnoughError* = object of CodexError

View File

@ -11,9 +11,9 @@ import pkg/libp2p
import pkg/stew/endians2
import pkg/datastore
import pkg/codex/stores/cachestore
import pkg/codex/chunker
import pkg/codex/stores
import pkg/codex/stores/consts
import pkg/codex/blocktype as bt
import pkg/codex/clock