Documentation ¶
Overview ¶
Package styxfile provides helper routines and interfaces for serving 9P files from Go types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoSeek = errors.New("file does not support seeking")
ErrNoSeek is returned when a given type does not support writing to any offset other than its current position after previous reads and writes.
var ErrNotSupported = errors.New("not supported")
ErrNotSupported is returned when a given type does not implement the necessary functionality to complete a given read/write operation.
var ErrSmallRead = errors.New("Tread count too small for dir stat")
ErrSmallRead is returned when a client's Tread request on a directory does not request enough bytes to hold at least one Stat structure.
Functions ¶
func QidType ¶
QidType selects the first byte of a 9P mode mask, and is suitable for use in a Qid's type field.
func SetDeadline ¶
SetDeadline sets read/write deadlines for a file, if the type supports it.
Types ¶
type Directory ¶
Types implementing the Directory interface can be made into 9P files by the NewDir function. This provides an easy way, for example, to provide directory listings from an *os.File.
type Interface ¶
Interface describes the methods a type must implement to be used as a file by a 9P file server. The New function converts types that implement some, but not all of these methods into types that do.
func New ¶
New creates a new Interface that reads and writes to and from rwc. The type of rwc determines the implementation selected by New; if rwc already implements Interface, it is used as-is. If some methods are missing, wrapper types are used to implement missing functionality. If the provided type cannot be adapted into an Interface, New returns a non-nil error.