xpipe

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_POLLINTERVAL  = float64(0.1)
	DEFAULT_POLLCHUNKSIZE = int(1024)
	DEFAULT_RWTIMEOUT     = float64(0)
)

Variables

View Source
var (
	ErrError   = errors.New("")
	ErrOpen    = fmt.Errorf("%wopen pipe failed", ErrError)
	ErrBreak   = fmt.Errorf("%woperation break", ErrError)
	ErrTimeout = fmt.Errorf("%woperation timeout", ErrError)
	ErrRead    = fmt.Errorf("%wread pipe failed", ErrError)
	ErrWrite   = fmt.Errorf("%wwrite pipe failed", ErrError)
)

Functions

func CreatePipe added in v0.3.8

func CreatePipe(path string, perm uint32) error

create new pipe on system, if not exist

func DeletePipe added in v0.3.8

func DeletePipe(path string) error

delete pipe file from system

Types

type Options added in v0.3.9

type Options = types.NDict

type Pipe

type Pipe struct {

	// read/write params
	PollInterval  float64
	PollChunkSize int
	ReadTimeout   float64
	WriteTimeout  float64
	// contains filtered or unexported fields
}

func NewPipe

func NewPipe(path string, opts Options) *Pipe

func (*Pipe) Cancel

func (p *Pipe) Cancel()

cancel active read/write operation on pipe

func (*Pipe) Path added in v0.3.8

func (p *Pipe) Path() string

return pipe file path

func (*Pipe) Read

func (p *Pipe) Read() ([]byte, error)

non-blocking read from pipe

func (*Pipe) ReadWait

func (p *Pipe) ReadWait(timeout float64) ([]byte, error)

read from pipe, until data is received or timeout. use timeout=0 to wait forever (blocking mode)

func (*Pipe) Write

func (p *Pipe) Write(data []byte) error

non-blocking write to pipe

func (*Pipe) WriteWait

func (p *Pipe) WriteWait(data []byte, timeout float64) error

write to pipe, wait until peer is connected use timeout=0 to wait forever (blocking mode)

Jump to

Keyboard shortcuts

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