mpio

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxSingleWriteSize = 4 * 1024
View Source
const MaxTotalRunDataSize = 10 * ReadBufSize
View Source
const ReadBufSize = 128 * 1024
View Source
const WriteBufSize = 128 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type FdReader

type FdReader struct {
	CVar          *sync.Cond
	M             *Multiplexer
	FdNum         int
	Fd            io.ReadCloser
	BufSize       int
	Closed        bool
	ShouldCloseFd bool
	IsPty         bool
}

func MakeFdReader

func MakeFdReader(m *Multiplexer, fd io.ReadCloser, fdNum int, shouldCloseFd bool, isPty bool) *FdReader

func (*FdReader) Close

func (r *FdReader) Close()

func (*FdReader) GetBufSize

func (r *FdReader) GetBufSize() int

func (*FdReader) NotifyAck

func (r *FdReader) NotifyAck(ackLen int)

func (*FdReader) ReadLoop

func (r *FdReader) ReadLoop(wg *sync.WaitGroup)

func (*FdReader) WriteWait

func (r *FdReader) WriteWait(data []byte, isEof bool) bool

returns (success)

type FdWriter

type FdWriter struct {
	CVar          *sync.Cond
	M             *Multiplexer
	FdNum         int
	Buffer        []byte
	BufferLimit   int
	Fd            io.WriteCloser
	Eof           bool
	Closed        bool
	ShouldCloseFd bool
	Desc          string
}

func MakeFdWriter

func MakeFdWriter(m *Multiplexer, fd io.WriteCloser, fdNum int, shouldCloseFd bool, desc string) *FdWriter

func (*FdWriter) AddData

func (w *FdWriter) AddData(data []byte, eof bool) error

func (*FdWriter) Close

func (w *FdWriter) Close()

func (*FdWriter) WaitForData

func (w *FdWriter) WaitForData() ([]byte, bool)

func (*FdWriter) WriteLoop

func (w *FdWriter) WriteLoop(wg *sync.WaitGroup)

type Multiplexer

type Multiplexer struct {
	Lock            *sync.Mutex
	CK              base.CommandKey
	FdReaders       map[int]*FdReader // synchronized
	FdWriters       map[int]*FdWriter // synchronized
	RunData         map[int]*FdReader // synchronized
	CloseAfterStart []*os.File        // synchronized

	Sender  *packet.PacketSender
	Input   *packet.PacketParser
	Started bool
	UPR     packet.UnknownPacketReporter

	Debug bool
}

func (*Multiplexer) Close

func (m *Multiplexer) Close()

func (*Multiplexer) HandleInputDone

func (m *Multiplexer) HandleInputDone()

func (*Multiplexer) MakeRawFdReader

func (m *Multiplexer) MakeRawFdReader(fdNum int, fd io.ReadCloser, shouldClose bool, isPty bool)

func (*Multiplexer) MakeRawFdWriter

func (m *Multiplexer) MakeRawFdWriter(fdNum int, fd io.WriteCloser, shouldClose bool, desc string)

func (*Multiplexer) MakeReaderPipe

func (m *Multiplexer) MakeReaderPipe(fdNum int) (*os.File, error)

returns the *writer* to connect to process, reader is put in FdReaders

func (*Multiplexer) MakeStaticWriterPipe

func (m *Multiplexer) MakeStaticWriterPipe(fdNum int, data []byte, bufferLimit int, desc string) (*os.File, error)

returns the *reader* to connect to process, writer is put in FdWriters

func (*Multiplexer) MakeWriterPipe

func (m *Multiplexer) MakeWriterPipe(fdNum int, desc string) (*os.File, error)

returns the *reader* to connect to process, writer is put in FdWriters

func (*Multiplexer) RunIOAndWait

func (m *Multiplexer) RunIOAndWait(packetParser *packet.PacketParser, sender *packet.PacketSender, waitOnReaders bool, waitOnWriters bool, waitForInputLoop bool) *packet.CmdDonePacketType

func (*Multiplexer) WriteDataToFd

func (m *Multiplexer) WriteDataToFd(fdNum int, data []byte, isEof bool) error

Jump to

Keyboard shortcuts

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