Expand description
A layered disk implementation, LayeredDisk
.
A layered disk is a disk composed of multiple layers. Each layer is a block device made up of sectors, but with the added per-sector state of whether the sector is present or not. When reading a sector, the layered disk will read from the topmost layer that has the sector present. When writing, the disk will write to the topmost layer.
A layer can also have caching behavior. If a layer is configured to cache reads, then sectors that are read from lower layers are written back to the layer. If a layer is configured to write through, then writes are written to the layer and the next layer. These can be useful to implement simple persistent and non-persistent caches, primarily designed for lazily populating local backing stores from remote sources.
Missing from this implementation is write-back caching and cache eviction, which would be needed for caches that are smaller than the disk. These require potentially complicated cache management policies and are probably best implemented in a separate disk implementation.
Modules§
Structs§
- Disk
Layer - A single layer which can be attached to a
LayeredDisk
. - Disk
Layer Metadata - Metadata of a particular layer, collected from various
LayerIo
APIs. - Layer
Configuration - A configuration for a layer in a
LayeredDisk
. - Layered
Disk - A disk composed of multiple layers.
- Sector
Marker - A type to mark sectors that have been read by a layer as part of a
LayerIo::read
operation.
Enums§
- Invalid
Layer - An error returned when creating a
DiskLayer
. - Invalid
Layered Disk - An error returned when creating a
LayeredDisk
.
Traits§
- Layer
Attach - Transition a layer from an unattached type-state, into an attached
type-state, capable of performing
LayerIo
. - LayerIo
- Metadata and IO for disk layers.
- Write
NoOverwrite - Writes to the layer without overwriting existing data.