Change back from uint64 to uint32s because no filesystem ought to ever need over 2^32 files (ZFS? What's that?)

This commit is contained in:
Seednode 2023-09-12 16:46:58 -05:00
parent e0d4b3882b
commit 3b4f8f7499
3 changed files with 21 additions and 21 deletions

View File

@ -117,9 +117,9 @@ Flags:
-h, --help help for roulette
--images enable support for image files
-i, --index expose index endpoints
--maximum-files uint skip directories with file counts above this value (default 18446744073709551615)
--minimum-files uint skip directories with file counts below this value (default 1)
--page-length uint pagination length for statistics and debug pages
--maximum-files uint32 skip directories with file counts above this value (default 4294967295)
--minimum-files uint32 skip directories with file counts below this value (default 1)
--page-length uint32 pagination length for statistics and debug pages
-p, --port uint16 port to listen on (default 8080)
--profile register net/http/pprof handlers
-r, --recursive recurse into subdirectories

View File

@ -53,10 +53,10 @@ func (f *Files) Append(directory, path string) {
}
type ScanStats struct {
filesMatched atomic.Uint64
filesSkipped atomic.Uint64
directoriesMatched atomic.Uint64
directoriesSkipped atomic.Uint64
filesMatched atomic.Uint32
filesSkipped atomic.Uint32
directoriesMatched atomic.Uint32
directoriesSkipped atomic.Uint32
}
type Path struct {
@ -363,9 +363,9 @@ func pathHasSupportedFiles(path string, formats *types.Types) (bool, error) {
}
}
func pathCount(path string) (uint64, uint64, error) {
var directories uint64 = 0
var files uint64 = 0
func pathCount(path string) (uint32, uint32, error) {
var directories uint32 = 0
var files uint32 = 0
nodes, err := os.ReadDir(path)
if err != nil {
@ -457,10 +457,10 @@ func fileList(paths []string, filters *Filters, sort string, index *FileIndex, f
}
stats := &ScanStats{
filesMatched: atomic.Uint64{},
filesSkipped: atomic.Uint64{},
directoriesMatched: atomic.Uint64{},
directoriesSkipped: atomic.Uint64{},
filesMatched: atomic.Uint32{},
filesSkipped: atomic.Uint32{},
directoriesMatched: atomic.Uint32{},
directoriesSkipped: atomic.Uint32{},
}
concurrency := &Concurrency{

View File

@ -12,7 +12,7 @@ import (
)
const (
ReleaseVersion string = "0.71.0"
ReleaseVersion string = "0.72.0"
)
var (
@ -25,9 +25,9 @@ var (
Flash bool
Images bool
Index bool
MaximumFileCount uint64
MinimumFileCount uint64
PageLength uint64
MaximumFileCount uint32
MinimumFileCount uint32
PageLength uint32
Port uint16
Profile bool
Recursive bool
@ -93,9 +93,9 @@ func init() {
rootCmd.Flags().BoolVar(&Flash, "flash", false, "enable support for shockwave flash files (via ruffle.rs)")
rootCmd.Flags().BoolVar(&Images, "images", false, "enable support for image files")
rootCmd.Flags().BoolVarP(&Index, "index", "i", false, "expose index endpoints")
rootCmd.Flags().Uint64Var(&MaximumFileCount, "maximum-files", 1<<64-1, "skip directories with file counts above this value")
rootCmd.Flags().Uint64Var(&MinimumFileCount, "minimum-files", 1, "skip directories with file counts below this value")
rootCmd.Flags().Uint64Var(&PageLength, "page-length", 0, "pagination length for statistics and debug pages")
rootCmd.Flags().Uint32Var(&MaximumFileCount, "maximum-files", 1<<32-1, "skip directories with file counts above this value")
rootCmd.Flags().Uint32Var(&MinimumFileCount, "minimum-files", 1, "skip directories with file counts below this value")
rootCmd.Flags().Uint32Var(&PageLength, "page-length", 0, "pagination length for statistics and debug pages")
rootCmd.Flags().Uint16VarP(&Port, "port", "p", 8080, "port to listen on")
rootCmd.Flags().BoolVar(&Profile, "profile", false, "register net/http/pprof handlers")
rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories")