plumb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: BSD-3-Clause, GooglePatentClause Imports: 8 Imported by: 22

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

Functions

func Open

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

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

Types

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