Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,14 @@ func Chunk(ctx context.Context,
var seekEnd int64 = seekStart + firstCut - 1
log.Infof("first cut %d, seek start at %d, end at %d", firstCut, seekStart, seekEnd)
log.Infof("----------------")
graphFiles = append(graphFiles, Finfo{
fi := Finfo{
Path: item.Path,
Name: fmt.Sprintf("%s.%08d", item.Info.Name(), fileSliceCount),
Info: item.Info,
SeekStart: seekStart,
SeekEnd: seekEnd,
})
}
graphFiles = append(graphFiles, tryRenameFileName([]Finfo{fi})...)
fileSliceCount++
// todo build ipld from graphFiles
BuildIpldGraph(ctx, append(ef.getFiles(), graphFiles...), GenGraphName(graphName, graphSliceCount, sliceTotal), parentPath, carDir, parallel, cb, expectSliceSize, ef)
Expand All @@ -239,13 +240,14 @@ func Chunk(ctx context.Context,
log.Infof("following cut %d, seek start at %d, end at %d", seekEnd-seekStart+1, seekStart, seekEnd)
log.Infof("----------------")
cumuSize += seekEnd - seekStart + 1
graphFiles = append(graphFiles, Finfo{
fi := Finfo{
Path: item.Path,
Name: fmt.Sprintf("%s.%08d", item.Info.Name(), fileSliceCount),
Info: item.Info,
SeekStart: seekStart,
SeekEnd: seekEnd,
})
}
graphFiles = append(graphFiles, tryRenameFileName([]Finfo{fi})...)
fileSliceCount++
if seekEnd-seekStart == partSliceSize-1 {
// todo build ipld from graphFiles
Expand Down
13 changes: 11 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,16 +598,25 @@ func tryRenameFileName(fis []Finfo) []Finfo {
return in
}
// 重新拼接文件名
return fmt.Sprintf("%s_%s.%s", parts[0], RandomLetters(), arr[1])
return fmt.Sprintf("%s_%s.%s", parts[0], RandomLetters(), strings.Join(arr[1:], "."))
}

for i, fi := range fis {
// log.Infof("try rename file: %s", fi.Name)
log.Infof("try rename file: %s", fi.Name)
if nameReg.MatchString(fi.Name) {
newName := rename(fi.Name)
fis[i].Name = newName
// log.Infof("rename file name %s to %s", fi.Name, newName)
}
// graphsplit_sss.png.00000001
arr := strings.Split(fi.Name, ".")
if len(arr) == 3 {
if nameReg.MatchString(arr[0] + "." + arr[1]) {
newName := rename(fi.Name)
fis[i].Name = newName
// log.Infof("rename file name %s to %s", fi.Name, newName)
}
}
}

return fis
Expand Down