1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

mfs: inherit CID prefix from from parent directory

License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
This commit is contained in:
Kevin Atkinson
2017-08-16 19:18:05 -04:00
parent 77e9b8ddf9
commit f2fbfdf291
7 changed files with 40 additions and 7 deletions

View File

@ -115,6 +115,7 @@ func (d *Directory) switchToSharding(ctx context.Context) error {
if err != nil {
return err
}
s.SetPrefix(&d.dirnode.Prefix)
d.shard = s
for _, lnk := range d.dirnode.Links() {
@ -192,3 +193,11 @@ func (d *Directory) GetNode() (node.Node, error) {
return d.shard.Node()
}
func (d *Directory) GetPrefix() *cid.Prefix {
if d.shard == nil {
return &d.dirnode.Prefix
}
return d.shard.Prefix()
}