feat: add rollback and virtual list

This commit is contained in:
Samuel N Cui
2023-10-12 22:54:07 +08:00
parent 7a2fb83d36
commit 59f626cef5
44 changed files with 3170 additions and 2560 deletions

View File

@@ -65,7 +65,7 @@ func (l *Library) ListPositions(ctx context.Context, tapeID int64, prefix string
return nil, fmt.Errorf("find position by file id fail, %w", r.Error)
}
convertPath := tools.Cache(func(p string) string { return strings.ReplaceAll(p, "/", "\x00") })
convertPath := tools.ThreadUnsafeCache(func(p string) string { return strings.ReplaceAll(p, "/", "\x00") })
sort.Slice(positions, func(i int, j int) bool {
return convertPath(positions[i].Path) < convertPath(positions[j].Path)
})