github.com/coocood/badger@v1.5.1-0.20200528065104-c02ac3616d04/fileutil/preallocate.go (about)

     1  package fileutil
     2  
     3  import "os"
     4  
     5  func Preallocate(f *os.File, size int64) error {
     6  	if size == 0 {
     7  		return nil
     8  	}
     9  	return preallocate(f, size)
    10  }
    11  
    12  func preallocateTrunc(f *os.File, size int64) error {
    13  	return f.Truncate(size)
    14  }