// HashDisk is a disk that spreads files in directories according to their name in order not to have a single folder with millions of subdirectories.
// For example the filename test/banana will be spread in te/st/test/banana
// Normally you would end up with an unbalanced distribution of folders, but since in real application filenames are already hashed (eg 6bf5ee0aea544986e84bf7abd5c96bde:matteosuppo/sketches/f7aca8a9-29f4-4420-9c7b-61d4e4064b84/sketch_sep25a/ReadMe.adoc), the problem is negligible
typeHashDiskstruct{
Basestring
NameOverridestring
CharacterMappingmap[string]string
}
func(d*HashDisk)Name()string{
ifd.NameOverride!=""{
returnd.NameOverride
}
return"HashDisk"
}
// ReadFile reads the file named by filename and returns the contents.
// A successful call returns err == nil, not err == EOF.
// Because ReadFile reads the whole file, it does not treat an EOF from Read
// as an error to be reported.
// It returns a notfound error if the file is missing