mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-17 23:36:33 +00:00
moves consts to stores folder
This commit is contained in:
parent
034473c84f
commit
41ae2abe62
@ -32,7 +32,7 @@ import pkg/ethers
|
|||||||
|
|
||||||
import ./discovery
|
import ./discovery
|
||||||
import ./stores
|
import ./stores
|
||||||
import ./consts
|
import ./stores/consts
|
||||||
|
|
||||||
export DefaultCacheSizeMiB, net, DefaultQuotaBytes, DefaultBlockTtl, DefaultBlockMaintenanceInterval, DefaultNumberOfBlocksToMaintainPerInterval, RepoKind
|
export DefaultCacheSizeMiB, net, DefaultQuotaBytes, DefaultBlockTtl, DefaultBlockMaintenanceInterval, DefaultNumberOfBlocksToMaintainPerInterval, RepoKind
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
type
|
|
||||||
RepoKind* = enum
|
|
||||||
repoFS = "fs"
|
|
||||||
repoSQLite = "sqlite"
|
|
||||||
|
|
||||||
const
|
|
||||||
MiB* = 1024 * 1024
|
|
@ -15,7 +15,7 @@ import pkg/confutils
|
|||||||
import pkg/confutils/defs
|
import pkg/confutils/defs
|
||||||
|
|
||||||
import ../namespaces
|
import ../namespaces
|
||||||
import ../consts
|
import ./consts
|
||||||
import ./blockstore
|
import ./blockstore
|
||||||
import ./repostore
|
import ./repostore
|
||||||
import ./cachestore
|
import ./cachestore
|
||||||
|
@ -21,7 +21,7 @@ import pkg/questionable
|
|||||||
import pkg/questionable/results
|
import pkg/questionable/results
|
||||||
|
|
||||||
import ./blockstore
|
import ./blockstore
|
||||||
import ../consts
|
import ./consts
|
||||||
import ../chunker
|
import ../chunker
|
||||||
import ../manifest
|
import ../manifest
|
||||||
|
|
||||||
@ -35,10 +35,6 @@ type
|
|||||||
backingStore: BlockStore
|
backingStore: BlockStore
|
||||||
cache: LruCache[Cid, Block]
|
cache: LruCache[Cid, Block]
|
||||||
|
|
||||||
const
|
|
||||||
DefaultCacheSizeMiB* = 5
|
|
||||||
DefaultCacheSize* = DefaultCacheSizeMiB * MiB
|
|
||||||
|
|
||||||
method getBlock*(self: CacheStore, cid: Cid): Future[?!Block] {.async.} =
|
method getBlock*(self: CacheStore, cid: Cid): Future[?!Block] {.async.} =
|
||||||
if cid.isEmpty:
|
if cid.isEmpty:
|
||||||
trace "Empty block, ignoring"
|
trace "Empty block, ignoring"
|
||||||
|
17
codex/stores/consts.nim
Normal file
17
codex/stores/consts.nim
Normal 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
|
@ -20,10 +20,6 @@ import ../utils/timer
|
|||||||
import ../clock
|
import ../clock
|
||||||
import ../systemclock
|
import ../systemclock
|
||||||
|
|
||||||
const
|
|
||||||
DefaultBlockMaintenanceInterval* = 10.minutes
|
|
||||||
DefaultNumberOfBlocksToMaintainPerInterval* = 1000
|
|
||||||
|
|
||||||
type
|
type
|
||||||
BlockMaintainer* = ref object of RootObj
|
BlockMaintainer* = ref object of RootObj
|
||||||
repoStore: RepoStore
|
repoStore: RepoStore
|
||||||
|
@ -22,7 +22,7 @@ import pkg/questionable
|
|||||||
import pkg/questionable/results
|
import pkg/questionable/results
|
||||||
|
|
||||||
import ./blockstore
|
import ./blockstore
|
||||||
import ../consts
|
import ./consts
|
||||||
import ../chunker
|
import ../chunker
|
||||||
import ../manifest
|
import ../manifest
|
||||||
|
|
||||||
@ -42,10 +42,6 @@ type
|
|||||||
table: Table[Cid, DoublyLinkedNode[MemoryStoreNode]]
|
table: Table[Cid, DoublyLinkedNode[MemoryStoreNode]]
|
||||||
list: DoublyLinkedList[MemoryStoreNode]
|
list: DoublyLinkedList[MemoryStoreNode]
|
||||||
|
|
||||||
const
|
|
||||||
DefaultMemoryStoreCapacityMiB* = 5
|
|
||||||
DefaultMemoryStoreCapacity* = DefaultMemoryStoreCapacityMiB * MiB
|
|
||||||
|
|
||||||
method getBlock*(self: MemoryStore, cid: Cid): Future[?!Block] {.async.} =
|
method getBlock*(self: MemoryStore, cid: Cid): Future[?!Block] {.async.} =
|
||||||
trace "Getting block from cache", cid
|
trace "Getting block from cache", cid
|
||||||
if cid.isEmpty:
|
if cid.isEmpty:
|
||||||
|
@ -21,6 +21,7 @@ import pkg/stew/endians2
|
|||||||
|
|
||||||
import ./blockstore
|
import ./blockstore
|
||||||
import ./keyutils
|
import ./keyutils
|
||||||
|
import ./consts
|
||||||
import ../blocktype
|
import ../blocktype
|
||||||
import ../clock
|
import ../clock
|
||||||
import ../systemclock
|
import ../systemclock
|
||||||
@ -30,10 +31,6 @@ export blocktype, libp2p
|
|||||||
logScope:
|
logScope:
|
||||||
topics = "codex repostore"
|
topics = "codex repostore"
|
||||||
|
|
||||||
const
|
|
||||||
DefaultBlockTtl* = 24.hours
|
|
||||||
DefaultQuotaBytes* = 1'u shl 33'u # ~8GB
|
|
||||||
|
|
||||||
type
|
type
|
||||||
QuotaUsedError* = object of CodexError
|
QuotaUsedError* = object of CodexError
|
||||||
QuotaNotEnoughError* = object of CodexError
|
QuotaNotEnoughError* = object of CodexError
|
||||||
|
@ -11,9 +11,9 @@ import pkg/libp2p
|
|||||||
import pkg/stew/endians2
|
import pkg/stew/endians2
|
||||||
import pkg/datastore
|
import pkg/datastore
|
||||||
|
|
||||||
import pkg/codex/stores/cachestore
|
|
||||||
import pkg/codex/chunker
|
import pkg/codex/chunker
|
||||||
import pkg/codex/stores
|
import pkg/codex/stores
|
||||||
|
import pkg/codex/stores/consts
|
||||||
import pkg/codex/blocktype as bt
|
import pkg/codex/blocktype as bt
|
||||||
import pkg/codex/clock
|
import pkg/codex/clock
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user