fs: Add interface and FS implementations

This adds two implementations of the new `FS` interface: One for the local
file system (`Local`) and one for a single file read from an
`io.Reader` (`Reader`).
This commit is contained in:
Alexander Neumann
2018-01-03 21:53:45 +01:00
parent 83ca08245b
commit c4b2486b7c
14 changed files with 994 additions and 14 deletions

16
internal/fs/const.go Normal file
View File

@@ -0,0 +1,16 @@
package fs
import "syscall"
// Flags to OpenFile wrapping those of the underlying system. Not all flags may
// be implemented on a given system.
const (
O_RDONLY int = syscall.O_RDONLY // open the file read-only.
O_WRONLY int = syscall.O_WRONLY // open the file write-only.
O_RDWR int = syscall.O_RDWR // open the file read-write.
O_APPEND int = syscall.O_APPEND // append data to the file when writing.
O_CREATE int = syscall.O_CREAT // create a new file if none exists.
O_EXCL int = syscall.O_EXCL // used with O_CREATE, file must not exist
O_SYNC int = syscall.O_SYNC // open for synchronous I/O.
O_TRUNC int = syscall.O_TRUNC // if possible, truncate file when opened.
)