github.com/anacrolix/torrent@v1.61.0/storage/file-io.go (about) 1 package storage 2 3 import ( 4 "io" 5 ) 6 7 type fileWriter interface { 8 io.WriterAt 9 io.Closer 10 } 11 12 type fileReader interface { 13 // Seeks to the next data in the file. If there is no more data, seeks to the end of the file. 14 seekDataOrEof(offset int64) (ret int64, err error) 15 writeToN(w io.Writer, n int64) (written int64, err error) 16 io.ReadCloser 17 } 18 19 type fileIo interface { 20 openForSharedRead(name string) (sharedFileIf, error) 21 openForRead(name string) (fileReader, error) 22 openForWrite(name string, size int64) (fileWriter, error) 23 flush(name string, offset, nbytes int64) error 24 rename(from, to string) error 25 }