Version: v0.0.4 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 8 Imported by: 21



Package plumb provides routines for sending and receiving messages for the plumber.



This section is empty.


View Source
var (
	ErrAttribute = errors.New("bad attribute syntax")
	ErrQuote     = errors.New("bad attribute quoting")


func Open

func Open(name string, mode int) (*client.Fid, error)

Open opens the plumbing file with the given name and open mode.


type Attribute

type Attribute struct {
	Name  string // The name of the attribute ("addr").
	Value string // The value of the attribute ("/long johns/")
	Next  *Attribute

Attribute represents a list of attributes for a single Message.

type Message

type Message struct {
	Src  string     // The source of the message ("acme").
	Dst  string     // The destination port of the message ("edit").
	Dir  string     // The working directory in which to interpret the message.
	Type string     // The type of the message ("text").
	Attr *Attribute // The attributes; may be nil.
	Data []byte     // The data; may be nil.

Message represents a message to or from the plumber.

func (*Message) LookupAttr

func (m *Message) LookupAttr(name string) string

LookupAttr returns the value associated with the named attribute. If the attribute is missing, LookupAttr returns an empty string. To distinguish an empty present attribute from a missing attribute, walk the m.Attr list directly instead of using LookupAttr.

func (*Message) Recv

func (m *Message) Recv(r io.ByteReader) error

Recv reads a message from the reader and stores it in the Message. Since encoded messages are properly delimited, Recv will not read any data beyond the message itself.

func (*Message) Send

func (m *Message) Send(w io.Writer) error

Send writes the message to the writer. The message will be sent with a single call to Write.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL