mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-01 22:37:51 +08:00
refactor: pull StreamCid outside of ChunkingManifest; streamCid is orthogonal to the chunking manifest
This commit is contained in:
parent
cd8e37b393
commit
765e1739be
@ -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".
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user