From 765e1739be2db3316292dd2939b09929bc4bdf61 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 3 Feb 2021 15:34:16 -0800 Subject: [PATCH] refactor: pull StreamCid outside of ChunkingManifest; streamCid is orthogonal to the chunking manifest --- core/coreunix/add.go | 6 ++++-- core/coreunix/bigfile.go | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 19df92a61..0e5727a9a 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -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". diff --git a/core/coreunix/bigfile.go b/core/coreunix/bigfile.go index 04626ed55..f90025f11 100644 --- a/core/coreunix/bigfile.go +++ b/core/coreunix/bigfile.go @@ -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