Documentation ¶
Index ¶
- type BasicDirHandler
- func (b *BasicDirHandler) Clunk(name string, fid protocol.FID) error
- func (b *BasicDirHandler) CreateChild(name string, child string) (int, error)
- func (b *BasicDirHandler) Open(name string, fid protocol.FID, mode protocol.Mode) error
- func (b *BasicDirHandler) Read(name string, fid protocol.FID, offset int64, count int64) ([]byte, error)
- func (b *BasicDirHandler) Remove(name string) error
- func (b *BasicDirHandler) Stat(name string) (protocol.Dir, error)
- func (b *BasicDirHandler) WalkChild(name string, child string) (int, error)
- func (b *BasicDirHandler) Write(name string, fid protocol.FID, offset int64, buf []byte) (int64, error)
- func (b *BasicDirHandler) Wstat(name string, dir protocol.Dir) error
- type FileEntry
- type FileHandler
- type Server
- func (s *Server) AddFileEntry(name string, handler FileHandler) int
- func (s *Server) HasChildren(name string) bool
- func (s *Server) MatchFile(matcher func(f *FileEntry) bool) int
- func (s *Server) MatchFiles(matcher func(f *FileEntry) bool) []int
- func (s *Server) Rattach(fid protocol.FID, afid protocol.FID, uname string, aname string) (protocol.QID, error)
- func (s *Server) Rclunk(fid protocol.FID) error
- func (s *Server) Rcreate(fid protocol.FID, name string, perm protocol.Perm, mode protocol.Mode) (protocol.QID, protocol.MaxSize, error)
- func (s *Server) Rflush(o protocol.Tag) error
- func (s *Server) Ropen(fid protocol.FID, mode protocol.Mode) (protocol.QID, protocol.MaxSize, error)
- func (s *Server) Rread(fid protocol.FID, o protocol.Offset, c protocol.Count) ([]byte, error)
- func (s *Server) Rremove(fid protocol.FID) error
- func (s *Server) Rstat(fid protocol.FID) ([]byte, error)
- func (s *Server) Rversion(msize protocol.MaxSize, version string) (protocol.MaxSize, string, error)
- func (s *Server) Rwalk(fid protocol.FID, newfid protocol.FID, paths []string) ([]protocol.QID, error)
- func (s *Server) Rwrite(fid protocol.FID, o protocol.Offset, b []byte) (protocol.Count, error)
- func (s *Server) Rwstat(fid protocol.FID, b []byte) error
- type ServerOpt
- type StaticFileHandler
- func (f *StaticFileHandler) Clunk(name string, fid protocol.FID) error
- func (f *StaticFileHandler) CreateChild(name string, child string) (int, error)
- func (f *StaticFileHandler) Open(name string, fid protocol.FID, mode protocol.Mode) error
- func (f *StaticFileHandler) Read(name string, fid protocol.FID, offset int64, count int64) ([]byte, error)
- func (f *StaticFileHandler) Remove(name string) error
- func (f *StaticFileHandler) Stat(name string) (protocol.Dir, error)
- func (f *StaticFileHandler) WalkChild(name string, child string) (int, error)
- func (f *StaticFileHandler) Write(name string, fid protocol.FID, offset int64, buf []byte) (int64, error)
- func (f *StaticFileHandler) Wstat(name string, qid protocol.Dir) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicDirHandler ¶
A basic directory handler interprets the file
entries to show its children. The handler does not support the creation of any children files.
func (*BasicDirHandler) Clunk ¶
func (b *BasicDirHandler) Clunk(name string, fid protocol.FID) error
func (*BasicDirHandler) CreateChild ¶
func (b *BasicDirHandler) CreateChild(name string, child string) (int, error)
func (*BasicDirHandler) Remove ¶
func (b *BasicDirHandler) Remove(name string) error
func (*BasicDirHandler) WalkChild ¶
func (b *BasicDirHandler) WalkChild(name string, child string) (int, error)
type FileEntry ¶
type FileEntry struct { Name string Handler FileHandler // contains filtered or unexported fields }
A file entry is a location in the filesystem tree with a handler
that handles the file operations for it. The server keeps track of the QID and FID's of the entries.
func NewFileEntry ¶
func NewFileEntry(name string, handler FileHandler) FileEntry
type FileHandler ¶
type FileHandler interface { WalkChild(name string, child string) (int, error) Open(name string, fid protocol.FID, mode protocol.Mode) error CreateChild(name string, child string) (int, error) Stat(name string) (protocol.Dir, error) Wstat(name string, dir protocol.Dir) error Remove(name string) error Read(name string, fid protocol.FID, offset int64, count int64) ([]byte, error) Write(name string, fid protocol.FID, offset int64, buf []byte) (int64, error) Clunk(name string, fid protocol.FID) error }
A file handler defines the behaviour of one or more file entries
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A server
func (*Server) AddFileEntry ¶
func (s *Server) AddFileEntry(name string, handler FileHandler) int
func (*Server) HasChildren ¶
type StaticFileHandler ¶
type StaticFileHandler struct {
Content []byte
}
Static file handler has a static contents that
is initiated at startup and cannot be modified. This is useful for README files and other helpful documentation for your filesystem.
func (*StaticFileHandler) Clunk ¶
func (f *StaticFileHandler) Clunk(name string, fid protocol.FID) error
func (*StaticFileHandler) CreateChild ¶
func (f *StaticFileHandler) CreateChild(name string, child string) (int, error)
func (*StaticFileHandler) Remove ¶
func (f *StaticFileHandler) Remove(name string) error
func (*StaticFileHandler) Stat ¶
func (f *StaticFileHandler) Stat(name string) (protocol.Dir, error)
func (*StaticFileHandler) WalkChild ¶
func (f *StaticFileHandler) WalkChild(name string, child string) (int, error)
Click to show internal directories.
Click to hide internal directories.