thinio

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package thinio provides functionality for orchestrating I/O operations on a block.Device.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = errors.New("conductor has been closed")

ErrClosed is returned if a caller attempts to perform any operations on a Conductor after it has been closed.

Functions

This section is empty.

Types

type Conductor

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

Conductor orchestrates all I/O operations on a block.Device, maintaining an internal cache of disk blocks for better performance

func NewConductor

func NewConductor(dev block.Device, cacheSize int) *Conductor

NewConductor returns a new, initialized Conductor for orchestrating I/O on dev. cacheSize should be the size in bytes of the cache that the Conductor should use for caching disk blocks.

func (*Conductor) Close

func (c *Conductor) Close() error

Close closes the Conductor as well as the underlying block.Device, rendering them unusable for I/O. Returns an error, if any. Future operations on the Conductor will return ErrClosed. Callers must call Flush before calling Close to ensure that all pending changes have been flushed to stable storage.

func (*Conductor) DeviceSize

func (c *Conductor) DeviceSize() int64

DeviceSize returns the size of the underlying device in bytes.

func (*Conductor) Discard

func (c *Conductor) Discard(off, size int64) error

Discard discards the data in the address range [off, off+size). Returns an error, if any.

func (*Conductor) Errors

func (c *Conductor) Errors() []error

Errors returns a slice of all the errors that have occurred during the Conductor's operation, if any. Callers must not modify the returned slice, which is invalidated if any other method is invoked on c.

func (*Conductor) Flush

func (c *Conductor) Flush() error

Flush flushes the Conductor's in-memory copy of recently written data to the underlying block.Device. Flush does not return until all previous writes are committed to stable storage. Returns an error, if any.

func (*Conductor) ReadAt

func (c *Conductor) ReadAt(p []byte, off int64) (int, error)

ReadAt implements io.ReaderAt for Conductor.

func (*Conductor) WriteAt

func (c *Conductor) WriteAt(p []byte, off int64) (int, error)

WriteAt implements io.WriterAt for Conductor.

Jump to

Keyboard shortcuts

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