filestream

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadCloser

type ReadCloser interface {
	Path() string
	Read(p []byte) (int, error)
	MustClose()
}

ReadCloser is a standard interface for filestream Reader.

type Reader

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

Reader implements buffered file reader.

func MustOpen added in v1.91.0

func MustOpen(path string, nocache bool) *Reader

MustOpen opens the file from the given path in nocache mode.

If nocache is set, then the reader doesn't pollute OS page cache.

func OpenReaderAt added in v1.29.0

func OpenReaderAt(path string, offset int64, nocache bool) (*Reader, error)

OpenReaderAt opens the file at the given path in nocache mode at the given offset.

If nocache is set, then the reader doesn't pollute OS page cache.

func (*Reader) MustClose

func (r *Reader) MustClose()

MustClose closes the underlying file passed to MustOpen.

func (*Reader) Path added in v1.91.0

func (r *Reader) Path() string

Path returns the path to r

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read reads file contents to p.

type WriteCloser

type WriteCloser interface {
	Path() string
	Write(p []byte) (int, error)
	MustClose()
}

WriteCloser is a standard interface for filestream Writer.

type Writer

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

Writer implements buffered file writer.

func MustCreate added in v1.91.0

func MustCreate(path string, nocache bool) *Writer

MustCreate creates the file for the given path in nocache mode.

If nocache is set, the writer doesn't pollute OS page cache.

func OpenWriterAt added in v1.29.0

func OpenWriterAt(path string, offset int64, nocache bool) (*Writer, error)

OpenWriterAt opens the file at path in nocache mode for writing at the given offset.

The file at path is created if it is missing.

If nocache is set, the writer doesn't pollute OS page cache.

func (*Writer) MustClose

func (w *Writer) MustClose()

MustClose syncs the underlying file to storage and then closes it.

func (*Writer) MustFlush added in v1.34.0

func (w *Writer) MustFlush(isSync bool)

MustFlush flushes all the buffered data to file.

if isSync is true, then the flushed data is fsynced to the underlying storage.

func (*Writer) Path added in v1.91.0

func (w *Writer) Path() string

Path returns the path to r

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Write writes p to the underlying file.

Jump to

Keyboard shortcuts

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