mirror of
https://github.com/status-im/nim-codex.git
synced 2025-01-11 19:34:32 +00:00
0beeefd760
* initial implementation of repo store * allow isManifest on multicodec * rework with new blockstore * add raw codec * rework listBlocks * remove fsstore * reworking with repostore * bump datastore * fix listBlocks iterator * adding store's common tests * run common store tests * remove fsstore backend tests * bump datastore * add `listBlocks` tests * listBlocks filter based on block type * disabling tests in need of rewriting * allow passing block type * move BlockNotFoundError definition * fix tests * increase default advertise loop sleep to 10 mins * use `self` * add cache quota functionality * pass meta store and start repo * add `CacheQuotaNamespace` * pass meta store * bump datastore to latest master * don't use os `/` as key separator * Added quota limits support * tests for quota limits * add block expiration key * remove unnesesary space * use idleAsync in listBlocks * proper test name * re-add contrlC try/except * add storage quota and block ttl config options * clarify comments * change expires key format * check for block presence before storing * bump datastore * use dht with fixed datastore `has` * bump datastore to latest master * bump dht to latest master
40 lines
1.0 KiB
Nim
40 lines
1.0 KiB
Nim
## Nim-Codex
|
|
## Copyright (c) 2022 Status Research & Development GmbH
|
|
## Licensed under either of
|
|
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
## at your option.
|
|
## This file may not be copied, modified, or distributed except according to
|
|
## those terms.
|
|
|
|
import pkg/upraises
|
|
|
|
push: {.upraises: [].}
|
|
|
|
import ../stores
|
|
|
|
type
|
|
Backend* = ref object of RootObj
|
|
blockSize*: int # block size in bytes
|
|
buffers*: int # number of original pieces
|
|
parity*: int # number of redundancy pieces
|
|
|
|
EncoderBackend* = ref object of Backend
|
|
DecoderBackend* = ref object of Backend
|
|
|
|
method release*(self: Backend) {.base.} =
|
|
raiseAssert("not implemented!")
|
|
|
|
method encode*(
|
|
self: EncoderBackend,
|
|
buffers,
|
|
parity: var openArray[seq[byte]]): Result[void, cstring] {.base.} =
|
|
raiseAssert("not implemented!")
|
|
|
|
method decode*(
|
|
self: DecoderBackend,
|
|
buffers,
|
|
parity,
|
|
recovered: var openArray[seq[byte]]): Result[void, cstring] {.base.} =
|
|
raiseAssert("not implemented!")
|