This commit is contained in:
2026-06-11 01:46:25 +00:00
parent 9ec86282ad
commit 09f270aa6f
5 changed files with 770 additions and 335 deletions

35
qb.go
View File

@@ -24,28 +24,36 @@ const (
)
type TimestampCompressor interface {
// (timestamp) => compressionWay, requiredSpace
Evaluate(uint32) (int, int)
Compress(int, uint32)
Size() int
// (tmp, timestamp)
Evaluate([]byte, uint32) TimeEvaluationReport
// (offset, tmp)
Append(int, []byte)
//Size() int
//Chunks() [][]byte
//DeleteLast()
CaptureState()
ForgetCapturedState()
CreateDecompressor() TimestampDecompressor
//Payload() []byte // для снапшота
Offset() int
// Offset() int
Rotate([]byte)
WritePayloadTo(io.Writer) error
LastTimestamp() uint32
ReplaceSinceWithUntil() uint32
}
type TimeEvaluationReport struct {
TotalSpace int
Offset int
ChangeSize int
}
type ValueCompressor interface {
// (value) => compressionWay, requiredSpace
Evaluate(float64) (int, int)
Compress(int, float64)
Size() int
// (tmp, value)
Evaluate([]byte, float64) ValueEvaluationReport
// (offset, tmp, delta)
Append(int, []byte, uint64)
//Size() int
//Chunks() [][]byte
//DeleteLast()
CaptureState()
@@ -53,12 +61,19 @@ type ValueCompressor interface {
// fracDigits
CreateDecompressor() ValueDecompressor
//Payload() []byte // для снапшота
Offset() int
//Offset() int
Rotate([]byte)
WritePayloadTo(io.Writer) error
LastValue() float64
}
type ValueEvaluationReport struct {
TotalSpace int
Offset int
ChangeSize int
Delta uint64
}
type TimestampDecompressor interface {
NextValue() (uint32, bool)
}