Documentation ¶
Overview ¶
Package fs provides helpers to implement 9p objects: directories and files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dir ¶
Dir implements a directory.
func NewDir ¶
NewDir creates a new Dir ready for use.
The stat and child entries are expected to be prepared by the caller. Children will have their parent set to this Dir.
func (*Dir) Open ¶
Open prepares the dir for access.
Internally, a stat.Reader is prepared from the contents of the children.
func (*Dir) Walk ¶
Walk to a child, the parent, or itself.
wname is either the name of a child, "..", or "". If it is the name of a child, the respective entry is returned. For ".." the parent, or the dir itself (if it is the root) is returned. When wname is the empty string, the dir itself is returned.
type Entry ¶
type Entry interface { Parent() Entry // Parent returns this objects parent, it may be nil for the root object. Qid() qid.Qid // Qid returns this files qid. Stat() stat.Stat // Stat returns this files stat. Open() error // Open prepares this file for access. Walk(string) (Entry, error) // Walk to a child or itself. io.ReadSeeker // All files and directories need this. }
Entry is the general interface for 9p objects.
type File ¶
type File struct { // this is the minimal interface we need, as a 9p read can also seek io.ReadSeeker // contains filtered or unexported fields }
File implements a file.
func NewFile ¶
func NewFile(s stat.Stat, rs io.ReadSeeker) *File
NewFile prepares a new File ready for use.
The stat and ReadSeeker are expected to be prepared by the caller.