Copyright | (c) 2017 Quixoftic LLC |
---|---|
License | BSD3 |
Maintainer | Drew Hess <dhess-src@quixoftic.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Types and functions to emulate a (pure) rudimentary Posix-style filesystem.
This module was written for internal use only. Its interface may change at any time. Documentation in this module is sparse, by design.
N.B.: This mock filesystem implementation was written with the
intention of doing only just enough to emulate the operations needed
by the MonadSysfs
type class. Though
it may be possible to use this implementation for other purposes, it
has neither been designed nor tested for that. Use at your own risk
and please do not submit requests for addtional functionality.
- type Name = FilePath
- data File = File {}
- data FileType
- data DirNode = DirNode {
- _dirNodeName :: !Name
- _files :: [File]
- type Directory = Tree DirNode
- directory :: Name -> [File] -> [Directory] -> Directory
- dirName :: Directory -> Name
- files :: Directory -> [File]
- dirNode :: Directory -> DirNode
- subdirs :: Directory -> [Directory]
- data MockFSCrumb = MockFSCrumb {}
- data MockFSZipper = MockFSZipper {
- _cwd :: Directory
- _crumbs :: [MockFSCrumb]
- cd :: FilePath -> MockFSZipper -> Either IOError MockFSZipper
- pathFromRoot :: MockFSZipper -> FilePath
- findFile :: Name -> Directory -> Maybe FileType
- mkdir :: Name -> MockFSZipper -> Either IOError MockFSZipper
- mkfile :: Name -> FileType -> Bool -> MockFSZipper -> Either IOError MockFSZipper
- rmdir :: Name -> MockFSZipper -> Either IOError MockFSZipper
- rmfile :: Name -> MockFSZipper -> Either IOError MockFSZipper
Mock filesystem types
DirNode | |
|
data MockFSCrumb Source #
data MockFSZipper Source #
An opaque type representing the current state of the mock sysfs
filesystem. Because the constructor is not exported via the public
interface, you cannot create these directly, but you can manipulate
them using the exposed mock sysfs
operations and then pass those
MockFSZipper
s around.
MockFSZipper | |
|
Mock filesystem operations
cd :: FilePath -> MockFSZipper -> Either IOError MockFSZipper Source #
pathFromRoot :: MockFSZipper -> FilePath Source #
mkdir :: Name -> MockFSZipper -> Either IOError MockFSZipper Source #
mkfile :: Name -> FileType -> Bool -> MockFSZipper -> Either IOError MockFSZipper Source #
rmdir :: Name -> MockFSZipper -> Either IOError MockFSZipper Source #
rmfile :: Name -> MockFSZipper -> Either IOError MockFSZipper Source #