Light cleanup (#616)

mostly whitespaces cleanup
This commit is contained in:
Dmitriy Ryajov 2023-11-14 11:52:27 -06:00 committed by GitHub
parent 06bb21bfc7
commit 8d61391073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 66 additions and 67 deletions

View File

@ -30,17 +30,17 @@ export types
type type
Manifest* = ref object of RootObj Manifest* = ref object of RootObj
treeCid {.serialize.}: Cid # Root of the merkle tree treeCid {.serialize.}: Cid # Root of the merkle tree
datasetSize {.serialize.}: NBytes # Total size of all blocks datasetSize {.serialize.}: NBytes # Total size of all blocks
blockSize {.serialize.}: NBytes # Size of each contained block (might not be needed if blocks are len-prefixed) blockSize {.serialize.}: NBytes # Size of each contained block (might not be needed if blocks are len-prefixed)
version: CidVersion # Cid version version: CidVersion # Cid version
hcodec: MultiCodec # Multihash codec hcodec: MultiCodec # Multihash codec
codec: MultiCodec # Data set codec codec: MultiCodec # Data set codec
case protected {.serialize.}: bool # Protected datasets have erasure coded info case protected {.serialize.}: bool # Protected datasets have erasure coded info
of true: of true:
ecK: int # Number of blocks to encode ecK: int # Number of blocks to encode
ecM: int # Number of resulting parity blocks ecM: int # Number of resulting parity blocks
originalTreeCid: Cid # The original root of the dataset being erasure coded originalTreeCid: Cid # The original root of the dataset being erasure coded
originalDatasetSize: NBytes originalDatasetSize: NBytes
else: else:
discard discard

View File

@ -96,7 +96,6 @@ proc encode(cidAndProof: (Cid, MerkleProof)): seq[byte] =
proc decode(_: type (Cid, MerkleProof), data: seq[byte]): ?!(Cid, MerkleProof) = proc decode(_: type (Cid, MerkleProof), data: seq[byte]): ?!(Cid, MerkleProof) =
let let
n = uint64.fromBytesBE(data[0..<sizeof(uint64)]).int n = uint64.fromBytesBE(data[0..<sizeof(uint64)]).int
let
cid = ? Cid.init(data[sizeof(uint64)..<sizeof(uint64) + n]).mapFailure cid = ? Cid.init(data[sizeof(uint64)..<sizeof(uint64) + n]).mapFailure
proof = ? MerkleProof.decode(data[sizeof(uint64) + n..^1]) proof = ? MerkleProof.decode(data[sizeof(uint64) + n..^1])
success((cid, proof)) success((cid, proof))