Documentation
¶
Index ¶
- Constants
- Variables
- func AlignToBlock(b []byte) []byte
- func EncodeTortureConfig(cfg TortureConfig) string
- func FillFromeCache(d []byte, cps []CachePosition) error
- func GenerateTortureData(rng *rand.Rand, pattern TortureDataPattern, blocks uint32) []byte
- func LogMetrics(log *slog.Logger)
- func NBDWrapper(ctx context.Context, log *slog.Logger, d *Disk) *nbdWrapper
- func ReadSegmentHeaders(r io.Reader) (SegmentHeader, []ExtentHeader, error)
- func ReadUvarint(r io.ByteReader) (uint64, int, error)
- func ReturnBuffers(buf *Buffers)
- func ReturnSegmentBuilder(seg *SegmentBuilder)
- func RoundToBlockSize(sz int64) int64
- func ToReader(ra io.ReaderAt) io.Reader
- func WriteUvarint(w io.ByteWriter, x uint64) (int, error)
- type Buffers
- type CachePosition
- type CompleteSegmentUploadResponse
- type CompleteUploadRequest
- type Config
- type Context
- type ControlMessage
- type Controller
- type CopyIterator
- type Cover
- type CreateVolumeRequest
- type DeleteSegmentResponse
- type Disk
- func (d *Disk) Close(ctx context.Context) error
- func (d *Disk) CloseSegment(ctx context.Context) error
- func (d *Disk) CopyIterator(ctx context.Context, seg SegmentId) (*CopyIterator, error)
- func (d *Disk) Extents() int
- func (d *Disk) GCOnce(ctx *Context) (SegmentId, error)
- func (d *Disk) Pack(ctx context.Context) error
- func (d *Disk) ReadExtent(ctx *Context, rng Extent) (RangeData, error)
- func (d *Disk) ReadExtentInto(ctx *Context, data RangeData) (CachePosition, error)
- func (r *Disk) SetAfterNS(f func(SegmentId))
- func (d *Disk) Size() int64
- func (d *Disk) SyncWriteCache() error
- func (d *Disk) WriteExtent(ctx context.Context, data RangeData) error
- func (d *Disk) WriteExtents(ctx context.Context, ranges []RangeData) error
- func (d *Disk) ZeroBlocks(ctx context.Context, rng Extent) error
- type DiskAPISegmentAccess
- func (d *DiskAPISegmentAccess) GetVolumeInfo(ctx context.Context, vol string) (*VolumeInfo, error)
- func (d *DiskAPISegmentAccess) InitContainer(ctx context.Context) error
- func (d *DiskAPISegmentAccess) InitVolume(ctx context.Context, vol *VolumeInfo) error
- func (d *DiskAPISegmentAccess) ListVolumes(ctx context.Context) ([]string, error)
- func (d *DiskAPISegmentAccess) OpenVolume(ctx context.Context, vol string) (Volume, error)
- func (d *DiskAPISegmentAccess) RemoveSegment(ctx context.Context, seg SegmentId) error
- type DiskAPISegmentReader
- type DiskAPIVolume
- func (v *DiskAPIVolume) Info(ctx context.Context) (*VolumeInfo, error)
- func (v *DiskAPIVolume) ListSegments(ctx context.Context) ([]SegmentId, error)
- func (v *DiskAPIVolume) NewSegment(ctx context.Context, seg SegmentId, layout *SegmentLayout, data *os.File) error
- func (v *DiskAPIVolume) OpenSegment(ctx context.Context, seg SegmentId) (SegmentReader, error)
- func (v *DiskAPIVolume) RemoveSegment(ctx context.Context, seg SegmentId) error
- type ErrorResponse
- type Event
- type EventKind
- type EventResult
- type Extent
- func (e Extent) ByteSize() int
- func (e Extent) Clamp(y Extent) (Extent, bool)
- func (e Extent) Contains(lba LBA) bool
- func (e Extent) Cover(y Extent) Cover
- func (e Extent) Last() LBA
- func (e Extent) Range() (LBA, LBA)
- func (e Extent) StartMask() *Mask
- func (e Extent) String() string
- func (e Extent) Sub(o Extent) ([]Extent, bool)
- func (e Extent) SubMany(subs []Extent) ([]Extent, bool)
- func (e Extent) SubSpecific(o Extent) (Extent, Extent, bool)
- func (e Extent) Valid() bool
- type ExtentCache
- type ExtentHeader
- type ExtentLocation
- type ExtentMap
- func (e *ExtentMap) Iterator() *Iterator
- func (e *ExtentMap) Len() int
- func (e *ExtentMap) LockToPatch(fn func() error) error
- func (m *ExtentMap) LockedIterator() *Iterator
- func (e *ExtentMap) Populate(log *slog.Logger, o *ExtentMap, diskId uint16) error
- func (e *ExtentMap) Render() string
- func (e *ExtentMap) RenderExpanded() string
- func (e *ExtentMap) Resolve(log *slog.Logger, rng Extent, ret []PartialExtent) ([]PartialExtent, error)
- func (m *ExtentMap) ToPE(c compactPE) PartialExtent
- func (e *ExtentMap) Update(log *slog.Logger, pba ExtentLocation, affected []PartialExtent) ([]PartialExtent, error)
- func (e *ExtentMap) UpdateBatch(log *slog.Logger, entries []ExtentLocation, segId SegmentId, s *Segments) error
- func (e *ExtentMap) Validate(log *slog.Logger) error
- type ExtentReader
- type ExternalExtentHeader
- func (v *ExternalExtentHeader) Blocks() uint32
- func (v *ExternalExtentHeader) HasBlocks() bool
- func (v *ExternalExtentHeader) HasLba() bool
- func (v *ExternalExtentHeader) HasOffset() bool
- func (v *ExternalExtentHeader) HasRawSize() bool
- func (v *ExternalExtentHeader) HasSize() bool
- func (v *ExternalExtentHeader) Lba() uint64
- func (v *ExternalExtentHeader) MarshalCBOR() ([]byte, error)
- func (v *ExternalExtentHeader) MarshalJSON() ([]byte, error)
- func (v *ExternalExtentHeader) Offset() uint32
- func (v *ExternalExtentHeader) RawSize() uint32
- func (v *ExternalExtentHeader) SetBlocks(blocks uint32)
- func (v *ExternalExtentHeader) SetLba(lba uint64)
- func (v *ExternalExtentHeader) SetOffset(offset uint32)
- func (v *ExternalExtentHeader) SetRawSize(raw_size uint32)
- func (v *ExternalExtentHeader) SetSize(size uint32)
- func (v *ExternalExtentHeader) Size() uint32
- func (v *ExternalExtentHeader) UnmarshalCBOR(data []byte) error
- func (v *ExternalExtentHeader) UnmarshalJSON(data []byte) error
- type FlushReason
- type Iterator
- type LBA
- type ListVolumesResponse
- type LocalFile
- type LocalFileAccess
- func (l *LocalFileAccess) AppendSegment(ctx context.Context, vol string, seg SegmentId, f *os.File) error
- func (l *LocalFileAccess) AppendToSegments(ctx context.Context, vol string, seg SegmentId) error
- func (l *LocalFileAccess) GetVolumeInfo(ctx context.Context, vol string) (*VolumeInfo, error)
- func (l *LocalFileAccess) InitContainer(ctx context.Context) error
- func (l *LocalFileAccess) InitVolume(ctx context.Context, vol *VolumeInfo) error
- func (l *LocalFileAccess) ListSegments(ctx context.Context, vol string) ([]SegmentId, error)
- func (l *LocalFileAccess) ListVolumes(ctx context.Context) ([]string, error)
- func (l *LocalFileAccess) OpenSegment(ctx context.Context, _ string, seg SegmentId) (SegmentReader, error)
- func (l *LocalFileAccess) OpenVolume(ctx context.Context, vol string) (Volume, error)
- func (l *LocalFileAccess) ReadMetadata(ctx context.Context, vol, name string) (io.ReadCloser, error)
- func (l *LocalFileAccess) RemoveSegment(ctx context.Context, seg SegmentId) error
- func (l *LocalFileAccess) RemoveSegmentFromVolume(ctx context.Context, vol string, seg SegmentId) error
- func (l *LocalFileAccess) UploadSegment(ctx context.Context, seg SegmentId, f *os.File) error
- func (l *LocalFileAccess) WriteMetadata(ctx context.Context, vol, name string) (io.WriteCloser, error)
- func (l *LocalFileAccess) WriteSegment(ctx context.Context, seg SegmentId) (io.WriteCloser, error)
- type LocalVolume
- func (l *LocalVolume) AppendSegment(ctx context.Context, seg SegmentId, f *os.File) error
- func (l *LocalVolume) Info(_ context.Context) (*VolumeInfo, error)
- func (l *LocalVolume) ListSegments(_ context.Context) ([]SegmentId, error)
- func (l *LocalVolume) NewSegment(ctx context.Context, seg SegmentId, layout *SegmentLayout, data *os.File) error
- func (l *LocalVolume) OpenSegment(_ context.Context, seg SegmentId) (SegmentReader, error)
- func (l *LocalVolume) RemoveSegment(_ context.Context, seg SegmentId) error
- type Mask
- type MetricSnapshot
- type NATSConnector
- type NBDBackendOpen
- type Option
- type Packer
- type PartialExtent
- type PreviousCache
- type RangeCache
- type RangeCacheOptions
- type RangeData
- func (r RangeData) Append(o RangeData) RangeData
- func (e *RangeData) CopyTo(data []byte) error
- func (r *RangeData) EmptyP() bool
- func (e *RangeData) RawBlocks() RawBlocks
- func (r *RangeData) ReadData() []byte
- func (r RangeData) Reader() io.Reader
- func (r *RangeData) SubRange(ext Extent) (RangeDataView, bool)
- func (r *RangeData) View() RangeDataView
- func (r *RangeData) WriteData() []byte
- type RangeDataView
- type RawBlocks
- type ReadExtenter
- type ReaderAtAsReader
- type ReconcileResult
- type S3Access
- func (s *S3Access) AppendSegment(ctx context.Context, vol string, seg SegmentId, f *os.File) error
- func (s *S3Access) AppendToSegments(ctx context.Context, vol string, seg SegmentId) error
- func (s *S3Access) GetVolumeInfo(ctx context.Context, vol string) (*VolumeInfo, error)
- func (s *S3Access) InitContainer(ctx context.Context) error
- func (s *S3Access) InitVolume(ctx context.Context, vol *VolumeInfo) error
- func (s *S3Access) ListSegments(ctx context.Context, vol string) ([]SegmentId, error)
- func (s *S3Access) ListVolumes(ctx context.Context) ([]string, error)
- func (s *S3Access) OpenSegment(ctx context.Context, _ string, seg SegmentId) (SegmentReader, error)
- func (s *S3Access) OpenVolume(ctx context.Context, name string) (Volume, error)
- func (s *S3Access) ReadMetadata(ctx context.Context, volName, name string) (io.ReadCloser, error)
- func (s *S3Access) RemoveSegment(ctx context.Context, seg SegmentId) error
- func (s *S3Access) RemoveSegmentFromVolume(ctx context.Context, vol string, seg SegmentId) error
- func (s *S3Access) UploadSegment(ctx context.Context, seg SegmentId, f *os.File) error
- func (s *S3Access) WriteMetadata(ctx context.Context, volName, name string) (io.WriteCloser, error)
- func (s *S3Access) WriteSegment(ctx context.Context, seg SegmentId) (io.WriteCloser, error)
- type S3ObjectReader
- type S3Volume
- func (s *S3Volume) AppendSegment(ctx context.Context, seg SegmentId, f *os.File) error
- func (s *S3Volume) Info(ctx context.Context) (*VolumeInfo, error)
- func (s *S3Volume) ListSegments(ctx context.Context) ([]SegmentId, error)
- func (s *S3Volume) NewSegment(ctx context.Context, seg SegmentId, layout *SegmentLayout, data *os.File) error
- func (s *S3Volume) OpenSegment(ctx context.Context, seg SegmentId) (SegmentReader, error)
- func (s *S3Volume) RemoveSegment(ctx context.Context, seg SegmentId) error
- type Segment
- type SegmentAccess
- type SegmentBuilder
- func (o *SegmentBuilder) BodySize() int
- func (o *SegmentBuilder) Close(log *slog.Logger) error
- func (o *SegmentBuilder) Flush(ctx context.Context, log *slog.Logger, vol Volume, seg SegmentId, ...) ([]ExtentLocation, *SegmentStats, error)
- func (o *SegmentBuilder) OpenP() bool
- func (o *SegmentBuilder) OpenWrite(path string, log *slog.Logger) error
- func (s *SegmentBuilder) Reset()
- func (o *SegmentBuilder) ShouldFlush(sizeThreshold int) FlushReason
- func (o *SegmentBuilder) Sync() error
- func (o *SegmentBuilder) WriteExtent(log *slog.Logger, ext RangeDataView) ([]byte, ExtentHeader, error)
- func (o *SegmentBuilder) ZeroBlocks(rng Extent) error
- type SegmentCreator
- func (o *SegmentCreator) AvgStorageRatio() float64
- func (o *SegmentCreator) BodySize() int
- func (o *SegmentCreator) Close() error
- func (o *SegmentCreator) CompressionRate() float64
- func (o *SegmentCreator) CompressionRateHistogram() []int
- func (o *SegmentCreator) EmptyBlocks() int
- func (o *SegmentCreator) EmptyP() bool
- func (o *SegmentCreator) Entries() int
- func (o *SegmentCreator) FillExtent(ctx *Context, data RangeDataView) ([]Extent, error)
- func (o *SegmentCreator) Flush(ctx context.Context, vol Volume, seg SegmentId) ([]ExtentLocation, *SegmentStats, error)
- func (o *SegmentCreator) InputBytes() int64
- func (o *SegmentCreator) ShouldFlush(sizeThreshold int) FlushReason
- func (o *SegmentCreator) StorageBytes() int64
- func (o *SegmentCreator) StorageRatio() float64
- func (o *SegmentCreator) TotalBlocks() int
- func (o *SegmentCreator) UseZstd()
- func (o *SegmentCreator) WriteExtent(ext RangeData) error
- func (o *SegmentCreator) ZeroBlocks(rng Extent) error
- type SegmentDownloadResponse
- type SegmentHeader
- type SegmentId
- type SegmentLayout
- func (v *SegmentLayout) Extents() []ExternalExtentHeader
- func (v *SegmentLayout) HasExtents() bool
- func (v *SegmentLayout) MarshalCBOR() ([]byte, error)
- func (v *SegmentLayout) MarshalJSON() ([]byte, error)
- func (v *SegmentLayout) SetExtents(extents []ExternalExtentHeader)
- func (v *SegmentLayout) UnmarshalCBOR(data []byte) error
- func (v *SegmentLayout) UnmarshalJSON(data []byte) error
- type SegmentReader
- type SegmentReconciler
- type SegmentStats
- type SegmentUploadRequest
- type SegmentUploadResponse
- type Segments
- func (d *Segments) AllDeadSegments() ([]SegmentId, error)
- func (s *Segments) Clear()
- func (s *Segments) Create(segId SegmentId, stats *SegmentStats)
- func (s *Segments) CreateOrUpdate(segId SegmentId, usedBlocks uint64)
- func (s *Segments) CreateWithExtents(segId SegmentId, stats *SegmentStats, extents int)
- func (s *Segments) FindDeleted() []SegmentId
- func (s *Segments) FindSmallSegments(cutoff, max uint64) []SegmentId
- func (s *Segments) IncrementSegment(segId SegmentId, blocks uint64)
- func (d *Segments) LeastDenseSegment(log *slog.Logger) (SegmentId, uint64, bool, error)
- func (s *Segments) LiveSegments() []SegmentId
- func (s *Segments) LogSegmentInfo(log hclog.Logger)
- func (d *Segments) PickSegmentToGC(log *slog.Logger, min float64, skip []SegmentId) (SegmentId, bool, error)
- func (s *Segments) PruneDeadSegments() (int, float64)
- func (s *Segments) SegmentBlocks(seg SegmentId) (uint64, uint64)
- func (s *Segments) SegmentIds() []SegmentId
- func (s *Segments) SegmentInfo(seg SegmentId) (uint64, uint64, int)
- func (s *Segments) SetDeleted(segId SegmentId, log *slog.Logger)
- func (s *Segments) SetSegment(segId SegmentId, total, used uint64)
- func (s *Segments) TotalBlocks() uint64
- func (s *Segments) TotalBytes() uint64
- func (s *Segments) UpdateUsage(log *slog.Logger, self SegmentId, affected []PartialExtent)
- func (s *Segments) Usage() float64
- func (s *Segments) UsedBlocks() uint64
- type StatsMessage
- type TortureBlockHash
- type TortureConfig
- type TortureDataPattern
- type TortureDiskModel
- func (m *TortureDiskModel) BlockCount() int
- func (m *TortureDiskModel) ExpectedHash(lba LBA) (TortureBlockHash, bool)
- func (m *TortureDiskModel) HasBlock(lba LBA) bool
- func (m *TortureDiskModel) WriteExtent(lba LBA, data []byte)
- func (m *TortureDiskModel) WrittenLBAs() []LBA
- func (m *TortureDiskModel) ZeroBlocks(lba LBA, blocks uint32)
- type TortureGenerator
- type TortureOpType
- type TortureOpWeights
- type TortureOperation
- type TortureResult
- type TortureRunner
- type TortureVariation
- type UlidRecall
- type Volume
- type VolumeInfo
- type VolumeInfoResponse
- type VolumeResponse
Constants ¶
const ( GCDensityThreshold = 70.0 GCTotalThreshold = 1024 * 1024 // 1MB )
const ( MaxBlocksPerSmallPack = 20_000 SmallSegmentCutOff = 200 TargetDensity = 90 )
const ( // The size of all blocks in bytes BlockSize = 4 * 1024 // How big the segment gets before we flush it to S3 FlushThreshHold = 32 * 1024 * 1024 // Maximum time a segment can stay open before being flushed MaxSegmentLifetime = 10 * time.Minute )
const ( MaxBlocks = math.MaxUint16 MaxLBA = (1 << 48) - 1 )
const ( Uncompressed = 0 Compressed = 1 Empty = 2 )
const BufferSliceSize = 1024 * 1024
const DefaultExtentsSize = 20000
const LevelTrace = slog.LevelDebug - 1
const MaxPoolBufferSize = 8 * 1024 * 1024
MaxPoolBufferSize is the maximum size of a buffer that will be returned to the pool. Buffers larger than this are discarded to prevent memory bloat.
const MaxSegBuilderBufSize = 16 * 1024 * 1024
MaxSegBuilderBufSize is the maximum buffer size for a SegmentBuilder to be returned to the pool. Builders with larger buffers are discarded.
const SegmentIdSize = 16
Variables ¶
var DefaultTortureConfig = TortureConfig{ Operations: 10000, MaxLBA: 100000, MaxBlocks: 64, Weights: DefaultTortureWeights, OverlapProbability: 0.3, VerifyEvery: 1000, PatternWeights: [4]int{60, 10, 20, 10}, }
DefaultTortureConfig provides a sensible default configuration
var DefaultTortureWeights = TortureOpWeights{
Write: 50,
Read: 30,
Zero: 10,
Sync: 5,
CloseReopen: 5,
}
DefaultTortureWeights provides sensible defaults for torture testing
var EnableAutoGC = func(o *opts) { o.autoGC = true }
var ErrReadOnly = errors.New("disk open'd read-only")
Functions ¶
func AlignToBlock ¶
func EncodeTortureConfig ¶
func EncodeTortureConfig(cfg TortureConfig) string
EncodeTortureConfig encodes a TortureConfig to a base64 JSON string for reproduction
func FillFromeCache ¶
func FillFromeCache(d []byte, cps []CachePosition) error
func GenerateTortureData ¶
func GenerateTortureData(rng *rand.Rand, pattern TortureDataPattern, blocks uint32) []byte
GenerateTortureData generates deterministic data from a seed and pattern
func LogMetrics ¶
func ReadSegmentHeaders ¶
func ReadSegmentHeaders(r io.Reader) (SegmentHeader, []ExtentHeader, error)
func ReadUvarint ¶
func ReadUvarint(r io.ByteReader) (uint64, int, error)
ReadUvarint reads an encoded unsigned integer from r and returns it as a uint64. The error is io.EOF only if no bytes were read. If an io.EOF happens after reading some but not all the bytes, ReadUvarint returns io.ErrUnexpectedEOF.
func ReturnBuffers ¶
func ReturnBuffers(buf *Buffers)
func ReturnSegmentBuilder ¶
func ReturnSegmentBuilder(seg *SegmentBuilder)
func RoundToBlockSize ¶
func WriteUvarint ¶
func WriteUvarint(w io.ByteWriter, x uint64) (int, error)
PutUvarint encodes a uint64 into buf and returns the number of bytes written. If the buffer is too small, PutUvarint will panic.
Types ¶
type Buffers ¶
type Buffers struct {
// contains filtered or unexported fields
}
func NewBuffers ¶
func NewBuffers() *Buffers
type CachePosition ¶
type CachePosition struct {
// contains filtered or unexported fields
}
type CompleteUploadRequest ¶
type Config ¶
type Config struct {
CachePath string `hcl:"cache_path"`
Storage struct {
FilePath string `hcl:"file_path,optional"`
S3 struct {
Bucket string `hcl:"bucket"`
Region string `hcl:"region"`
AccessKey string `hcl:"access_key,optional"`
SecretKey string `hcl:"secret_key,optional"`
Directory string `hcl:"directory,optional"`
URL string `hcl:"host,optional"`
} `hcl:"s3,block"`
} `hcl:"storage,block"`
}
func LoadConfig ¶
type ControlMessage ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(ctx context.Context, d *Disk) (*Controller, error)
func (*Controller) EventsCh ¶
func (c *Controller) EventsCh() chan Event
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context)
type CopyIterator ¶
type CopyIterator struct {
// contains filtered or unexported fields
}
func (*CopyIterator) ProcessFromExtents ¶
func (c *CopyIterator) ProcessFromExtents(ctx *Context, log *slog.Logger) error
type CreateVolumeRequest ¶
type CreateVolumeRequest struct {
Name string `json:"name"`
UUID string `json:"uuid"`
DeclaredSize int64 `json:"declared_size"`
DataFormat string `json:"data_format,omitempty"`
AppFormat string `json:"app_format,omitempty"`
Segments []string `json:"segments"`
BlockMap map[string]any `json:"block_map"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Volume API types
type DeleteSegmentResponse ¶
type Disk ¶
func (*Disk) CloseSegment ¶
CloseSegment synchronously closes the current segment, as well as giving any background GC process to finish up first.
func (*Disk) CopyIterator ¶
func (*Disk) ReadExtentInto ¶
func (d *Disk) ReadExtentInto(ctx *Context, data RangeData) (CachePosition, error)
func (*Disk) SetAfterNS ¶
func (*Disk) SyncWriteCache ¶
func (*Disk) WriteExtents ¶
WriteExtents writes multiple extents without performing any segment flush checking between them, thusly making sure that all of them end up in the same segment.
type DiskAPISegmentAccess ¶
type DiskAPISegmentAccess struct {
// contains filtered or unexported fields
}
func NewDiskAPISegmentAccess ¶
func NewDiskAPISegmentAccess(log *slog.Logger, baseURL string, authClient *cloudauth.AuthClient) *DiskAPISegmentAccess
func (*DiskAPISegmentAccess) GetVolumeInfo ¶
func (d *DiskAPISegmentAccess) GetVolumeInfo(ctx context.Context, vol string) (*VolumeInfo, error)
func (*DiskAPISegmentAccess) InitContainer ¶
func (d *DiskAPISegmentAccess) InitContainer(ctx context.Context) error
func (*DiskAPISegmentAccess) InitVolume ¶
func (d *DiskAPISegmentAccess) InitVolume(ctx context.Context, vol *VolumeInfo) error
func (*DiskAPISegmentAccess) ListVolumes ¶
func (d *DiskAPISegmentAccess) ListVolumes(ctx context.Context) ([]string, error)
func (*DiskAPISegmentAccess) OpenVolume ¶
func (*DiskAPISegmentAccess) RemoveSegment ¶
func (d *DiskAPISegmentAccess) RemoveSegment(ctx context.Context, seg SegmentId) error
type DiskAPISegmentReader ¶
type DiskAPISegmentReader struct {
// contains filtered or unexported fields
}
func (*DiskAPISegmentReader) Close ¶
func (r *DiskAPISegmentReader) Close() error
func (*DiskAPISegmentReader) Layout ¶
func (r *DiskAPISegmentReader) Layout(ctx context.Context) (*SegmentLayout, error)
type DiskAPIVolume ¶
type DiskAPIVolume struct {
// contains filtered or unexported fields
}
func (*DiskAPIVolume) Info ¶
func (v *DiskAPIVolume) Info(ctx context.Context) (*VolumeInfo, error)
func (*DiskAPIVolume) ListSegments ¶
func (v *DiskAPIVolume) ListSegments(ctx context.Context) ([]SegmentId, error)
func (*DiskAPIVolume) NewSegment ¶
func (v *DiskAPIVolume) NewSegment(ctx context.Context, seg SegmentId, layout *SegmentLayout, data *os.File) error
func (*DiskAPIVolume) OpenSegment ¶
func (v *DiskAPIVolume) OpenSegment(ctx context.Context, seg SegmentId) (SegmentReader, error)
func (*DiskAPIVolume) RemoveSegment ¶
func (v *DiskAPIVolume) RemoveSegment(ctx context.Context, seg SegmentId) error
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type Event ¶
type Event struct {
Kind EventKind
Value any
SegmentId SegmentId
Done chan EventResult
}
type EventResult ¶
type Extent ¶
func ExtentFrom ¶
type ExtentCache ¶
type ExtentCache struct {
// contains filtered or unexported fields
}
func NewExtentCache ¶
func NewExtentCache(log hclog.Logger, path string) (*ExtentCache, error)
func (*ExtentCache) Close ¶
func (e *ExtentCache) Close() error
func (*ExtentCache) ReadExtent ¶
func (e *ExtentCache) ReadExtent(robpb *PartialExtent, data []byte) (bool, error)
func (*ExtentCache) WriteExtent ¶
func (e *ExtentCache) WriteExtent(robpb *PartialExtent, data []byte) error
type ExtentHeader ¶
type ExtentHeader struct {
Extent `json:"extent" cbor:"1,keyasint"`
Size uint32 `json:"size" cbor:"2,keyasint"`
Offset uint32 `json:"offset" cbor:"3,keyasint"`
// used when the extent is compressed
RawSize uint32 `json:"raw_size,omitempty" cbor:"4,keyasint,omitempty"`
}
func (*ExtentHeader) Flags ¶
func (e *ExtentHeader) Flags() byte
func (*ExtentHeader) Read ¶
func (e *ExtentHeader) Read(r io.ByteReader) (int, error)
func (*ExtentHeader) Write ¶
func (e *ExtentHeader) Write(w io.ByteWriter) (int, error)
type ExtentLocation ¶
type ExtentLocation struct {
ExtentHeader `json:"header" cbor:"1,keyasint"`
Segment SegmentId `json:"segment" cbor:"2,keyasint"`
Disk uint16 `json:"disk" cbor:"3,keyasint"`
}
type ExtentMap ¶
type ExtentMap struct {
// contains filtered or unexported fields
}
func NewExtentMap ¶
func NewExtentMap() *ExtentMap
func (*ExtentMap) LockToPatch ¶
func (*ExtentMap) LockedIterator ¶
func (*ExtentMap) RenderExpanded ¶
func (*ExtentMap) Resolve ¶
func (e *ExtentMap) Resolve(log *slog.Logger, rng Extent, ret []PartialExtent) ([]PartialExtent, error)
func (*ExtentMap) ToPE ¶
func (m *ExtentMap) ToPE(c compactPE) PartialExtent
func (*ExtentMap) Update ¶
func (e *ExtentMap) Update(log *slog.Logger, pba ExtentLocation, affected []PartialExtent) ([]PartialExtent, error)
func (*ExtentMap) UpdateBatch ¶
type ExtentReader ¶
type ExtentReader struct {
// contains filtered or unexported fields
}
func NewExtentReader ¶
func (*ExtentReader) Close ¶
func (d *ExtentReader) Close() error
type ExternalExtentHeader ¶
type ExternalExtentHeader struct {
// contains filtered or unexported fields
}
func (*ExternalExtentHeader) Blocks ¶
func (v *ExternalExtentHeader) Blocks() uint32
func (*ExternalExtentHeader) HasBlocks ¶
func (v *ExternalExtentHeader) HasBlocks() bool
func (*ExternalExtentHeader) HasLba ¶
func (v *ExternalExtentHeader) HasLba() bool
func (*ExternalExtentHeader) HasOffset ¶
func (v *ExternalExtentHeader) HasOffset() bool
func (*ExternalExtentHeader) HasRawSize ¶
func (v *ExternalExtentHeader) HasRawSize() bool
func (*ExternalExtentHeader) HasSize ¶
func (v *ExternalExtentHeader) HasSize() bool
func (*ExternalExtentHeader) Lba ¶
func (v *ExternalExtentHeader) Lba() uint64
func (*ExternalExtentHeader) MarshalCBOR ¶
func (v *ExternalExtentHeader) MarshalCBOR() ([]byte, error)
func (*ExternalExtentHeader) MarshalJSON ¶
func (v *ExternalExtentHeader) MarshalJSON() ([]byte, error)
func (*ExternalExtentHeader) Offset ¶
func (v *ExternalExtentHeader) Offset() uint32
func (*ExternalExtentHeader) RawSize ¶
func (v *ExternalExtentHeader) RawSize() uint32
func (*ExternalExtentHeader) SetBlocks ¶
func (v *ExternalExtentHeader) SetBlocks(blocks uint32)
func (*ExternalExtentHeader) SetLba ¶
func (v *ExternalExtentHeader) SetLba(lba uint64)
func (*ExternalExtentHeader) SetOffset ¶
func (v *ExternalExtentHeader) SetOffset(offset uint32)
func (*ExternalExtentHeader) SetRawSize ¶
func (v *ExternalExtentHeader) SetRawSize(raw_size uint32)
func (*ExternalExtentHeader) SetSize ¶
func (v *ExternalExtentHeader) SetSize(size uint32)
func (*ExternalExtentHeader) Size ¶
func (v *ExternalExtentHeader) Size() uint32
func (*ExternalExtentHeader) UnmarshalCBOR ¶
func (v *ExternalExtentHeader) UnmarshalCBOR(data []byte) error
func (*ExternalExtentHeader) UnmarshalJSON ¶
func (v *ExternalExtentHeader) UnmarshalJSON(data []byte) error
type Iterator ¶
type Iterator struct {
treemap.ForwardIterator[LBA, compactPE]
// contains filtered or unexported fields
}
func (*Iterator) CompactValue ¶
func (e *Iterator) CompactValue() compactPE
func (*Iterator) CompactValuePtr ¶
func (e *Iterator) CompactValuePtr() *compactPE
func (*Iterator) Value ¶
func (e *Iterator) Value() PartialExtent
type ListVolumesResponse ¶
type ListVolumesResponse struct {
Volumes []VolumeInfoResponse `json:"volumes"`
NextCursor string `json:"next_cursor,omitempty"`
}
type LocalFileAccess ¶
func (*LocalFileAccess) AppendSegment ¶
func (*LocalFileAccess) AppendToSegments ¶
func (*LocalFileAccess) GetVolumeInfo ¶
func (l *LocalFileAccess) GetVolumeInfo(ctx context.Context, vol string) (*VolumeInfo, error)
func (*LocalFileAccess) InitContainer ¶
func (l *LocalFileAccess) InitContainer(ctx context.Context) error
func (*LocalFileAccess) InitVolume ¶
func (l *LocalFileAccess) InitVolume(ctx context.Context, vol *VolumeInfo) error
func (*LocalFileAccess) ListSegments ¶
func (*LocalFileAccess) ListVolumes ¶
func (l *LocalFileAccess) ListVolumes(ctx context.Context) ([]string, error)
func (*LocalFileAccess) OpenSegment ¶
func (l *LocalFileAccess) OpenSegment(ctx context.Context, _ string, seg SegmentId) (SegmentReader, error)
func (*LocalFileAccess) OpenVolume ¶
func (*LocalFileAccess) ReadMetadata ¶
func (l *LocalFileAccess) ReadMetadata(ctx context.Context, vol, name string) (io.ReadCloser, error)
func (*LocalFileAccess) RemoveSegment ¶
func (l *LocalFileAccess) RemoveSegment(ctx context.Context, seg SegmentId) error
func (*LocalFileAccess) RemoveSegmentFromVolume ¶
func (*LocalFileAccess) UploadSegment ¶
func (*LocalFileAccess) WriteMetadata ¶
func (l *LocalFileAccess) WriteMetadata(ctx context.Context, vol, name string) (io.WriteCloser, error)
func (*LocalFileAccess) WriteSegment ¶
func (l *LocalFileAccess) WriteSegment(ctx context.Context, seg SegmentId) (io.WriteCloser, error)
type LocalVolume ¶
func (*LocalVolume) AppendSegment ¶
func (*LocalVolume) Info ¶
func (l *LocalVolume) Info(_ context.Context) (*VolumeInfo, error)
func (*LocalVolume) ListSegments ¶
func (l *LocalVolume) ListSegments(_ context.Context) ([]SegmentId, error)
func (*LocalVolume) NewSegment ¶
func (l *LocalVolume) NewSegment(ctx context.Context, seg SegmentId, layout *SegmentLayout, data *os.File) error
func (*LocalVolume) OpenSegment ¶
func (l *LocalVolume) OpenSegment(_ context.Context, seg SegmentId) (SegmentReader, error)
func (*LocalVolume) RemoveSegment ¶
func (l *LocalVolume) RemoveSegment(_ context.Context, seg SegmentId) error
type MetricSnapshot ¶
type MetricSnapshot struct {
BlocksWritten int64
BlocksRead int64
IOPS int64
SegmentsWritten int64
}
func GetMetrics ¶
func GetMetrics() MetricSnapshot
type NATSConnector ¶
type NATSConnector struct {
// contains filtered or unexported fields
}
func NewNATSConnector ¶
type NBDBackendOpen ¶
func (*NBDBackendOpen) Close ¶
func (n *NBDBackendOpen) Close(b nbd.Backend)
func (*NBDBackendOpen) Open ¶
func (n *NBDBackendOpen) Open() nbd.Backend
type Option ¶
type Option func(o *opts)
func AfterNewSegment ¶
func AutoCreate ¶
func WithLowerLayer ¶
func WithSegmentAccess ¶
func WithSegmentAccess(sa SegmentAccess) Option
func WithSeqGen ¶
func WithVolumeName ¶
type PartialExtent ¶
type PartialExtent struct {
Live Extent `json:"live" cbor:"1,keyasint"`
ExtentLocation `json:"location" cbor:"2,keyasint"`
}
func (*PartialExtent) String ¶
func (r *PartialExtent) String() string
type PreviousCache ¶
type PreviousCache struct {
// contains filtered or unexported fields
}
PreviousCache manages holding onto a single segment creator as the previous cache.
func NewPreviousCache ¶
func NewPreviousCache() *PreviousCache
func (*PreviousCache) Clear ¶
func (p *PreviousCache) Clear()
func (*PreviousCache) Load ¶
func (p *PreviousCache) Load() *SegmentCreator
func (*PreviousCache) SetWhenClear ¶
func (p *PreviousCache) SetWhenClear(sc *SegmentCreator)
type RangeCache ¶
type RangeCache struct {
// contains filtered or unexported fields
}
func NewRangeCache ¶
func NewRangeCache(opts RangeCacheOptions) (*RangeCache, error)
func (*RangeCache) CachePositions ¶
func (r *RangeCache) CachePositions(ctx context.Context, seg SegmentId, total, off int64, ret []CachePosition) ([]CachePosition, error)
func (*RangeCache) Close ¶
func (r *RangeCache) Close() error
type RangeCacheOptions ¶
type RangeData ¶
type RangeData struct {
Extent
// contains filtered or unexported fields
}
func MapRangeData ¶
func NewRangeData ¶
func (*RangeData) View ¶
func (r *RangeData) View() RangeDataView
type RangeDataView ¶
type RangeDataView struct {
Extent
// contains filtered or unexported fields
}
func (RangeDataView) ByteSize ¶
func (v RangeDataView) ByteSize() int
func (RangeDataView) Copy ¶
func (d RangeDataView) Copy(s RangeDataView) int
func (RangeDataView) EmptyP ¶
func (v RangeDataView) EmptyP() bool
func (RangeDataView) ReadData ¶
func (v RangeDataView) ReadData() []byte
func (RangeDataView) SubRange ¶
func (r RangeDataView) SubRange(ext Extent) (RangeDataView, bool)
func (RangeDataView) WriteData ¶
func (v RangeDataView) WriteData() []byte
type ReadExtenter ¶
type ReaderAtAsReader ¶
type ReaderAtAsReader struct {
// contains filtered or unexported fields
}
type ReconcileResult ¶
type ReconcileResult struct {
TotalPrimary int
TotalReplica int
Missing int
Uploaded int
Failed int
FailedSegments []SegmentId
}
ReconcileResult contains the results of a reconciliation operation
type S3Access ¶
type S3Access struct {
// contains filtered or unexported fields
}
func NewS3Access ¶
func (*S3Access) AppendSegment ¶
func (*S3Access) AppendToSegments ¶
func (*S3Access) GetVolumeInfo ¶
func (*S3Access) InitVolume ¶
func (s *S3Access) InitVolume(ctx context.Context, vol *VolumeInfo) error
func (*S3Access) ListSegments ¶
func (*S3Access) ListVolumes ¶
func (*S3Access) OpenSegment ¶
func (*S3Access) OpenVolume ¶
func (*S3Access) ReadMetadata ¶
func (*S3Access) RemoveSegment ¶
func (*S3Access) RemoveSegmentFromVolume ¶
func (*S3Access) UploadSegment ¶
func (*S3Access) WriteMetadata ¶
func (*S3Access) WriteSegment ¶
type S3ObjectReader ¶
type S3ObjectReader struct {
// contains filtered or unexported fields
}
func (*S3ObjectReader) Close ¶
func (s *S3ObjectReader) Close() error
func (*S3ObjectReader) Layout ¶
func (s *S3ObjectReader) Layout(ctx context.Context) (*SegmentLayout, error)
type S3Volume ¶
type S3Volume struct {
// contains filtered or unexported fields
}
func (*S3Volume) AppendSegment ¶
func (*S3Volume) ListSegments ¶
func (*S3Volume) NewSegment ¶
func (*S3Volume) OpenSegment ¶
type Segment ¶
type SegmentAccess ¶
type SegmentAccess interface {
InitContainer(ctx context.Context) error
InitVolume(ctx context.Context, vol *VolumeInfo) error
ListVolumes(ctx context.Context) ([]string, error)
RemoveSegment(ctx context.Context, seg SegmentId) error
OpenVolume(ctx context.Context, vol string) (Volume, error)
GetVolumeInfo(ctx context.Context, vol string) (*VolumeInfo, error)
}
func ReplicaWriter ¶
func ReplicaWriter(log *slog.Logger, primary, replica SegmentAccess) SegmentAccess
type SegmentBuilder ¶
type SegmentBuilder struct {
// contains filtered or unexported fields
}
func NewSegmentBuilder ¶
func NewSegmentBuilder() *SegmentBuilder
func (*SegmentBuilder) BodySize ¶
func (o *SegmentBuilder) BodySize() int
func (*SegmentBuilder) Flush ¶
func (o *SegmentBuilder) Flush(ctx context.Context, log *slog.Logger, vol Volume, seg SegmentId, volName string, ) ([]ExtentLocation, *SegmentStats, error)
func (*SegmentBuilder) OpenP ¶
func (o *SegmentBuilder) OpenP() bool
func (*SegmentBuilder) OpenWrite ¶
func (o *SegmentBuilder) OpenWrite(path string, log *slog.Logger) error
func (*SegmentBuilder) Reset ¶
func (s *SegmentBuilder) Reset()
func (*SegmentBuilder) ShouldFlush ¶
func (o *SegmentBuilder) ShouldFlush(sizeThreshold int) FlushReason
func (*SegmentBuilder) Sync ¶
func (o *SegmentBuilder) Sync() error
func (*SegmentBuilder) WriteExtent ¶
func (o *SegmentBuilder) WriteExtent(log *slog.Logger, ext RangeDataView) ([]byte, ExtentHeader, error)
func (*SegmentBuilder) ZeroBlocks ¶
func (o *SegmentBuilder) ZeroBlocks(rng Extent) error
type SegmentCreator ¶
type SegmentCreator struct {
// contains filtered or unexported fields
}
func NewSegmentCreator ¶
func NewSegmentCreator(log *slog.Logger, vol, path string) (*SegmentCreator, error)
func (*SegmentCreator) AvgStorageRatio ¶
func (o *SegmentCreator) AvgStorageRatio() float64
func (*SegmentCreator) BodySize ¶
func (o *SegmentCreator) BodySize() int
func (*SegmentCreator) Close ¶
func (o *SegmentCreator) Close() error
func (*SegmentCreator) CompressionRate ¶
func (o *SegmentCreator) CompressionRate() float64
func (*SegmentCreator) CompressionRateHistogram ¶
func (o *SegmentCreator) CompressionRateHistogram() []int
func (*SegmentCreator) EmptyBlocks ¶
func (o *SegmentCreator) EmptyBlocks() int
func (*SegmentCreator) EmptyP ¶
func (o *SegmentCreator) EmptyP() bool
func (*SegmentCreator) Entries ¶
func (o *SegmentCreator) Entries() int
func (*SegmentCreator) FillExtent ¶
func (o *SegmentCreator) FillExtent(ctx *Context, data RangeDataView) ([]Extent, error)
FillExtent attempts to fill as much of +data+ as possible, returning a list of Extents that was unable to fill. That later list is then feed to the system that reads data from segments.
func (*SegmentCreator) Flush ¶
func (o *SegmentCreator) Flush(ctx context.Context, vol Volume, seg SegmentId, ) ([]ExtentLocation, *SegmentStats, error)
func (*SegmentCreator) InputBytes ¶
func (o *SegmentCreator) InputBytes() int64
func (*SegmentCreator) ShouldFlush ¶
func (o *SegmentCreator) ShouldFlush(sizeThreshold int) FlushReason
func (*SegmentCreator) StorageBytes ¶
func (o *SegmentCreator) StorageBytes() int64
func (*SegmentCreator) StorageRatio ¶
func (o *SegmentCreator) StorageRatio() float64
func (*SegmentCreator) TotalBlocks ¶
func (o *SegmentCreator) TotalBlocks() int
func (*SegmentCreator) UseZstd ¶
func (o *SegmentCreator) UseZstd()
func (*SegmentCreator) WriteExtent ¶
func (o *SegmentCreator) WriteExtent(ext RangeData) error
func (*SegmentCreator) ZeroBlocks ¶
func (o *SegmentCreator) ZeroBlocks(rng Extent) error
type SegmentDownloadResponse ¶
type SegmentHeader ¶
func ReadSegmentHeader ¶
func ReadSegmentHeader(path string) (*SegmentHeader, error)
type SegmentId ¶
func ParseSegment ¶
type SegmentLayout ¶
type SegmentLayout struct {
// contains filtered or unexported fields
}
func (*SegmentLayout) Extents ¶
func (v *SegmentLayout) Extents() []ExternalExtentHeader
func (*SegmentLayout) HasExtents ¶
func (v *SegmentLayout) HasExtents() bool
func (*SegmentLayout) MarshalCBOR ¶
func (v *SegmentLayout) MarshalCBOR() ([]byte, error)
func (*SegmentLayout) MarshalJSON ¶
func (v *SegmentLayout) MarshalJSON() ([]byte, error)
func (*SegmentLayout) SetExtents ¶
func (v *SegmentLayout) SetExtents(extents []ExternalExtentHeader)
func (*SegmentLayout) UnmarshalCBOR ¶
func (v *SegmentLayout) UnmarshalCBOR(data []byte) error
func (*SegmentLayout) UnmarshalJSON ¶
func (v *SegmentLayout) UnmarshalJSON(data []byte) error
type SegmentReader ¶
type SegmentReconciler ¶
type SegmentReconciler struct {
// contains filtered or unexported fields
}
SegmentReconciler syncs segments from primary to replica
func NewSegmentReconciler ¶
func NewSegmentReconciler(log *slog.Logger, primary, replica Volume) *SegmentReconciler
NewSegmentReconciler creates a new segment reconciler
func (*SegmentReconciler) Reconcile ¶
func (r *SegmentReconciler) Reconcile(ctx context.Context) (*ReconcileResult, error)
Reconcile finds segments in primary that are missing from replica and uploads them
type SegmentStats ¶
type SegmentUploadRequest ¶
type SegmentUploadRequest struct {
LsvdID string `json:"lsvd_id"`
VolumeID string `json:"volume_id,omitempty"`
}
API request/response types based on the OpenAPI spec
type SegmentUploadResponse ¶
type Segments ¶
type Segments struct {
// contains filtered or unexported fields
}
func NewSegments ¶
func NewSegments() *Segments
func (*Segments) AllDeadSegments ¶
func (*Segments) Create ¶
func (s *Segments) Create(segId SegmentId, stats *SegmentStats)
func (*Segments) CreateOrUpdate ¶
func (*Segments) CreateWithExtents ¶
func (s *Segments) CreateWithExtents(segId SegmentId, stats *SegmentStats, extents int)
CreateWithExtents creates a segment with a specific extent count
func (*Segments) FindDeleted ¶
func (*Segments) FindSmallSegments ¶
func (*Segments) IncrementSegment ¶
func (*Segments) LeastDenseSegment ¶
func (*Segments) LiveSegments ¶
func (*Segments) LogSegmentInfo ¶
func (*Segments) PickSegmentToGC ¶
func (*Segments) PruneDeadSegments ¶
func (*Segments) SegmentIds ¶
func (*Segments) SegmentInfo ¶
SegmentInfo returns size, used blocks, and extent count for a segment
func (*Segments) SetSegment ¶
func (*Segments) TotalBlocks ¶
func (*Segments) TotalBytes ¶
func (*Segments) UpdateUsage ¶
func (s *Segments) UpdateUsage(log *slog.Logger, self SegmentId, affected []PartialExtent)
func (*Segments) UsedBlocks ¶
type StatsMessage ¶
type StatsMessage struct {
Id string `json:"id" cbor:"10,keyasint"`
PublishTime time.Time `json:"published_at" cbor:"1,keyasint"`
GCCycles int64 `json:"gc_cycles" cbor:"2,keyasint"`
GCTime float64 `json:"gc_time" cbor:"3,keyasint"`
Extents int64 `json:"extents" cbor:"4,keyasint"`
Density float64 `json:"density" cbor:"5,keyasint"`
}
type TortureBlockHash ¶
type TortureBlockHash [8]byte
TortureBlockHash is a compact representation of block contents for verification
func HashBlock ¶
func HashBlock(data []byte) TortureBlockHash
type TortureConfig ¶
type TortureConfig struct {
Seed int64 `json:"Seed"`
Operations int `json:"Operations"`
MaxLBA LBA `json:"MaxLBA"`
MaxBlocks uint32 `json:"MaxBlocks"`
Weights TortureOpWeights `json:"Weights"`
OverlapProbability float64 `json:"OverlapProbability"`
VerifyEvery int `json:"VerifyEvery"`
PatternWeights [4]int `json:"PatternWeights"` // random, zero, compressible, sequential
}
TortureConfig contains all configuration for a torture test run
func DecodeTortureConfig ¶
func DecodeTortureConfig(encoded string) (TortureConfig, error)
DecodeTortureConfig decodes a base64 JSON string back to a TortureConfig
type TortureDataPattern ¶
type TortureDataPattern int
TortureDataPattern represents a data pattern for write operations
const ( TorturePatternRandom TortureDataPattern = iota TorturePatternZero TorturePatternCompressible TorturePatternSequential )
type TortureDiskModel ¶
type TortureDiskModel struct {
// contains filtered or unexported fields
}
TortureDiskModel is a simple reference model tracking expected disk state
func NewTortureDiskModel ¶
func NewTortureDiskModel() *TortureDiskModel
func (*TortureDiskModel) BlockCount ¶
func (m *TortureDiskModel) BlockCount() int
func (*TortureDiskModel) ExpectedHash ¶
func (m *TortureDiskModel) ExpectedHash(lba LBA) (TortureBlockHash, bool)
func (*TortureDiskModel) HasBlock ¶
func (m *TortureDiskModel) HasBlock(lba LBA) bool
func (*TortureDiskModel) WriteExtent ¶
func (m *TortureDiskModel) WriteExtent(lba LBA, data []byte)
func (*TortureDiskModel) WrittenLBAs ¶
func (m *TortureDiskModel) WrittenLBAs() []LBA
func (*TortureDiskModel) ZeroBlocks ¶
func (m *TortureDiskModel) ZeroBlocks(lba LBA, blocks uint32)
type TortureGenerator ¶
type TortureGenerator struct {
// contains filtered or unexported fields
}
TortureGenerator generates deterministic operation sequences
func NewTortureGenerator ¶
func NewTortureGenerator(cfg TortureConfig) *TortureGenerator
func (*TortureGenerator) Next ¶
func (g *TortureGenerator) Next() TortureOperation
type TortureOpType ¶
type TortureOpType int
TortureOpType represents a type of operation in the torture test
const ( TortureOpWrite TortureOpType = iota TortureOpRead TortureOpZero TortureOpSync TortureOpCloseReopen )
func (TortureOpType) String ¶
func (o TortureOpType) String() string
type TortureOpWeights ¶
type TortureOpWeights struct {
Write int `json:"Write"`
Read int `json:"Read"`
Zero int `json:"Zero"`
Sync int `json:"Sync"`
CloseReopen int `json:"CloseReopen"`
}
TortureOpWeights defines the probability weights for each operation type
type TortureOperation ¶
type TortureOperation struct {
Type TortureOpType
Extent Extent
DataSeed int64
Pattern TortureDataPattern
}
TortureOperation represents a single operation in the torture test
func (TortureOperation) String ¶
func (o TortureOperation) String() string
type TortureResult ¶
type TortureResult struct {
Success bool
Operations int
LBAsUsed int
Error error
History []TortureOperation
}
TortureResult contains the result of a torture test run
type TortureRunner ¶
type TortureRunner struct {
// contains filtered or unexported fields
}
TortureRunner runs torture tests against an LSVD disk
func NewTortureRunner ¶
func NewTortureRunner(gctx context.Context, log *slog.Logger, tmpDir string, cfg TortureConfig) (*TortureRunner, error)
NewTortureRunner creates a new torture test runner
func (*TortureRunner) Cleanup ¶
func (r *TortureRunner) Cleanup()
Cleanup cleans up resources used by the runner
func (*TortureRunner) DumpHistory ¶
func (r *TortureRunner) DumpHistory(last int)
DumpHistory writes the last N operations to the output writer
func (*TortureRunner) DumpHistoryRange ¶
func (r *TortureRunner) DumpHistoryRange(start, end int)
DumpHistoryRange prints operations in the range [start, end)
func (*TortureRunner) Run ¶
func (r *TortureRunner) Run() TortureResult
Run executes the torture test
func (*TortureRunner) SetOutput ¶
func (r *TortureRunner) SetOutput(w io.Writer)
SetOutput sets the output writer for progress messages
type TortureVariation ¶
type TortureVariation struct {
Name string
Weights TortureOpWeights
Overlap float64
MaxLBA LBA
}
TortureVariation defines a named torture test configuration variation
func DefaultTortureVariations ¶
func DefaultTortureVariations() []TortureVariation
DefaultTortureVariations returns the standard set of torture test variations
type UlidRecall ¶
func (*UlidRecall) First ¶
func (u *UlidRecall) First() ulid.ULID
func (*UlidRecall) Gen ¶
func (u *UlidRecall) Gen() ulid.ULID
type Volume ¶
type Volume interface {
Info(ctx context.Context) (*VolumeInfo, error)
ListSegments(ctx context.Context) ([]SegmentId, error)
OpenSegment(ctx context.Context, seg SegmentId) (SegmentReader, error)
NewSegment(ctx context.Context, seg SegmentId, layout *SegmentLayout, data *os.File) error
RemoveSegment(ctx context.Context, seg SegmentId) error
}
type VolumeInfo ¶
type VolumeInfo struct {
Name string `json:"name"`
Size units.Bytes `json:"size"`
Parent string `json:"parent"`
UUID string `json:"uuid"`
}
func (*VolumeInfo) Normalize ¶
func (vol *VolumeInfo) Normalize() error
type VolumeInfoResponse ¶
type VolumeInfoResponse struct {
VolumeID string `json:"volume_id"`
Name string `json:"name"`
UUID string `json:"uuid"`
DeclaredSize int64 `json:"declared_size"`
DataFormat string `json:"data_format,omitempty"`
AppFormat string `json:"app_format,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type VolumeResponse ¶
Source Files
¶
- buffers.go
- checksum.go
- close_segment.go
- config.go
- context.go
- control.go
- cover.go
- disk.go
- disk_api_segment.go
- extent.go
- extent_cache.go
- extent_map.go
- extent_reader.go
- gc.go
- headers.go
- interfaces.go
- local_segment.go
- metrics.go
- nats.go
- nbd.go
- options.go
- pack.go
- prev_cache.go
- range_cache.go
- range_data.go
- reader_at_adapter.go
- rebuild.go
- reconciler.go
- rpc.gen.go
- rpc.go
- s3.go
- segment.go
- segment_access.go
- segment_id.go
- segment_parser.go
- segments.go
- torture.go
- trace.go
- ulid.go
- util.go
- validation.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
lsvd
command
|
|
|
torture
command
|
|
|
cmd/lve
command
|
|
|
pkg
|
|
|
nbdnl
Package nbdnl controls the Linux NBD driver via netlink.
|
Package nbdnl controls the Linux NBD driver via netlink. |
|
treemap
Package treemap provides a generic key-sorted map.
|
Package treemap provides a generic key-sorted map. |