cleanup manifest

This commit is contained in:
Dmitriy Ryajov 2022-03-11 16:40:39 -06:00
parent 472e1e6fc3
commit 2a7cc7725c
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
1 changed files with 46 additions and 0 deletions

46
dagger/manifest/types.nim Normal file
View File

@ -0,0 +1,46 @@
## Nim-Dagger
## 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.
{.push raises: [Defect].}
import pkg/libp2p
import pkg/questionable
template EmptyDigests*: untyped =
var
emptyDigests {.global, threadvar.}:
array[CIDv0..CIDv1, Table[MultiCodec, MultiHash]]
once:
emptyDigests = [
CIDv0: {
multiCodec("sha2-256"): Cid
.init("bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku")
.get()
.mhash
.get()
}.toTable,
CIDv1: {
multiCodec("sha2-256"): Cid
.init("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n")
.get()
.mhash
.get()
}.toTable,
]
emptyDigests
type
Manifest* = object of RootObj
rootHash*: ?Cid
blocks*: seq[Cid]
version*: CidVersion
hcodec*: MultiCodec
codec*: MultiCodec