iomux

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: GPL-2.0, GPL-2.0-or-later Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &Mux{}

Functions

func Add

func Add(f Filer)

func Del

func Del(f Filer)

func Update

func Update(f Filer)

func Wait

func Wait(once bool)

Types

type AvailableReader

type AvailableReader interface {
	// Read from is file is currently allowed.
	ReadAvailable() bool
}

type File

type File struct {
	Fd int
	// contains filtered or unexported fields
}

func (*File) GetFile

func (f *File) GetFile() *File

func (*File) Index

func (f *File) Index() uint

func (*File) SetReadOnly

func (f *File) SetReadOnly()

func (*File) SetWriteOnly

func (f *File) SetWriteOnly()

type FileBuf

type FileBuf struct {
	File
	// contains filtered or unexported fields
}

func NewFileBuf

func NewFileBuf(fd int, format string, args ...interface{}) *FileBuf

func (*FileBuf) Close

func (s *FileBuf) Close() (err error)

func (*FileBuf) ErrorReady

func (s *FileBuf) ErrorReady() (err error)

func (*FileBuf) Read

func (s *FileBuf) Read(advance int) []byte

func (*FileBuf) ReadReady

func (s *FileBuf) ReadReady() (err error)

func (*FileBuf) String

func (f *FileBuf) String() string

func (*FileBuf) TxBuf

func (s *FileBuf) TxBuf() elib.ByteVec

func (*FileBuf) TxLen

func (s *FileBuf) TxLen() int

func (*FileBuf) Write

func (s *FileBuf) Write(p []byte) (n int, err error)

func (*FileBuf) WriteAvailable

func (s *FileBuf) WriteAvailable() bool

func (*FileBuf) WriteReady

func (s *FileBuf) WriteReady() (err error)

type FileReadWriteCloser

type FileReadWriteCloser interface {
	Filer
	io.Writer
	io.Closer
	Read(advance int) []byte
}

type Filer

type Filer interface {
	GetFile() *File
	// OS indicates that file is ready to read and/or write.
	ReadReady() error
	WriteReady() error
	ErrorReady() error
	// User has data available to write to file.
	WriteAvailable() bool
	// Stringer for logging.
	String() string
}

type Mux

type Mux struct {
	// contains filtered or unexported fields
}

func (*Mux) Add

func (m *Mux) Add(f Filer)

Add adds a file to the file poller, certainly for read and possibly for write depending on f.WriteReady()

func (*Mux) Del

func (m *Mux) Del(f Filer)

Del removes the file (descriptor) from polling and frees file pool entry.

func (*Mux) Elts

func (p *Mux) Elts() uint

func (*Mux) EventPoll

func (m *Mux) EventPoll()

func (*Mux) Foreach

func (p *Mux) Foreach(f func(x Filer))

func (*Mux) ForeachIndex

func (p *Mux) ForeachIndex(f func(i uint))

func (*Mux) GetIndex

func (p *Mux) GetIndex() (i uint)

func (*Mux) IsFree

func (p *Mux) IsFree(i uint) (v bool)

func (*Mux) Len

func (p *Mux) Len() uint

func (*Mux) PutIndex

func (p *Mux) PutIndex(i uint) (ok bool)

func (*Mux) Reset

func (p *Mux) Reset()

func (*Mux) Resize

func (p *Mux) Resize(n uint)

func (*Mux) Update

func (m *Mux) Update(f Filer)

Update is needed when f.WriteReady() changes value.

func (*Mux) Validate

func (p *Mux) Validate(i uint)

func (*Mux) Wait

func (m *Mux) Wait(once bool)

Jump to

Keyboard shortcuts

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