Documentation
¶
Overview ¶
Package thinio provides functionality for orchestrating I/O operations on a block.Device.
Index ¶
- Variables
- type Conductor
- func (c *Conductor) Close() error
- func (c *Conductor) DeviceSize() int64
- func (c *Conductor) Discard(off, size int64) error
- func (c *Conductor) Errors() []error
- func (c *Conductor) Flush() error
- func (c *Conductor) ReadAt(p []byte, off int64) (int, error)
- func (c *Conductor) WriteAt(p []byte, off int64) (int, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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 ¶
DeviceSize returns the size of the underlying device in bytes.
func (*Conductor) Discard ¶
Discard discards the data in the address range [off, off+size). Returns an error, if any.
func (*Conductor) Errors ¶
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 ¶
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.