refactor: pull StreamCid outside of ChunkingManifest; streamCid is orthogonal to the chunking manifest

This commit is contained in:
Petar Maymounkov 2021-02-03 15:34:16 -08:00
parent cd8e37b393
commit 765e1739be
2 changed files with 4 additions and 4 deletions

View File

@ -5,11 +5,12 @@ import (
"crypto/sha256"
"errors"
"fmt"
"github.com/multiformats/go-multihash"
"io"
gopath "path"
"strconv"
"github.com/multiformats/go-multihash"
"github.com/ipfs/go-cid"
bstore "github.com/ipfs/go-ipfs-blockstore"
chunker "github.com/ipfs/go-ipfs-chunker"
@ -427,7 +428,8 @@ func (adder *Adder) addFile(path string, file files.File) error {
if err != nil {
return err
}
chunkingManifest.StreamCid = cid.NewCidV1(cid.Raw, mh)
sha256StreamCid := cid.NewCidV1(cid.Raw, mh)
_ = sha256StreamCid // TODO: use this when inserting into the "big file store"
}
// TODO: place the chunkingManifest into the "big file store".

View File

@ -9,7 +9,6 @@ import (
)
type ChunkingManifest struct {
StreamCid cid.Cid
ChunkedCid cid.Cid
Chunks []*ChunkingManifestChunk
}
@ -23,7 +22,6 @@ type ChunkingManifestChunk struct {
func extractChunkingManifest(ctx context.Context, dagSvc ipld.DAGService, chunkedFileCid cid.Cid) (*ChunkingManifest, error) {
getLinks := dag.GetLinksWithDAG(dagSvc)
chunking := &ChunkingManifest{
// TODO: compute and set stream cid (aka "SID")
ChunkedCid: chunkedFileCid,
}
var verr error