utils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FollowedFile

type FollowedFile struct {
	*os.File
	// contains filtered or unexported fields
}

func FollowFile

func FollowFile(path string) (file *FollowedFile, err error)

func (FollowedFile) Close

func (f FollowedFile) Close() error

func (FollowedFile) Read

func (f FollowedFile) Read(b []byte) (int, error)

type NopFlusher

type NopFlusher struct{}

func (*NopFlusher) Flush

func (f *NopFlusher) Flush()

Flush is a nop operation.

type WriteFlusher

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

WriteFlusher wraps the Write and Flush operation ensuring that every write is a flush. In addition, the Close method can be called to intercept Read/Write calls if the targets lifecycle has already ended.

func NewWriteFlusher

func NewWriteFlusher(w io.Writer) *WriteFlusher

NewWriteFlusher returns a new WriteFlusher.

func (*WriteFlusher) Close

func (wf *WriteFlusher) Close() error

Close closes the write flusher, disallowing any further writes to the target. After the flusher is closed, all calls to write or flush will result in an error.

func (*WriteFlusher) Flush

func (wf *WriteFlusher) Flush()

Flush the stream immediately.

func (*WriteFlusher) Flushed

func (wf *WriteFlusher) Flushed() bool

Flushed returns the state of flushed. If it's flushed, return true, or else it return false.

func (*WriteFlusher) Write

func (wf *WriteFlusher) Write(b []byte) (n int, err error)

Notes

Bugs

  • Remove this method. Its use is inherently racy. Seems to be used to detect whether or a response code has been issued or not. Another hook should be used instead.

Jump to

Keyboard shortcuts

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