This commit is contained in:
2026-05-21 23:38:52 +03:00
parent 793df29e11
commit e7ec6083cb
21 changed files with 1234 additions and 1017 deletions

View File

@@ -76,8 +76,9 @@ func (s *ReverseCumulativeDeltaCompressor) Size() int {
return s.pos
}
//func (s *ReverseCumulativeDeltaCompressor) CalcRequiredSpace(value float64) int {
//}
func (s *ReverseCumulativeDeltaCompressor) CalcRequiredSpace(value float64) int {
return 0
}
func (s *ReverseCumulativeDeltaCompressor) Append(value float64) {
if s.pos == 0 {

View File

@@ -157,6 +157,37 @@ func (s *ReverseInstantDeltaCompressor) GetState() InstantDeltaBound {
}
}
func (s *ReverseInstantDeltaCompressor) Lock() {
// s.state = &CumulativeDeltaBound{
// Pos: s.pos - 1 - s.lastDeltaSize,
// H: s.h,
// LastDelta: s.lastDelta,
// Chunks: s.buf.Chunks(),
// }
}
func (s *ReverseInstantDeltaCompressor) Unlock() {
//s.state = nil
}
func (s *ReverseInstantDeltaCompressor) Renew() {
s.buf = conbuf.New(nil)
s.pos = 0
//
s.baseValue = 0
s.lastDelta = 0
s.lastDeltaSize = 0
s.h = 0
}
func (s *ReverseInstantDeltaCompressor) CalcRequiredSpace(value float64) int {
return 0
}
func (s *ReverseInstantDeltaCompressor) Chunks() [][]byte {
return s.buf.Chunks()
}
// DECOMPRESSOR
type ReverseInstantDeltaDecompressor struct {

View File

@@ -45,8 +45,13 @@ func (s *ReverseTimeDeltaCompressor) Size() int {
return s.pos
}
//func (s *ReverseTimeDeltaCompressor) CalcRequiredSpace(value float64) int {
//}
func (s *ReverseTimeDeltaCompressor) Chunks() [][]byte {
return s.buf.Chunks()
}
func (s *ReverseTimeDeltaCompressor) CalcRequiredSpace(value uint32) int {
return 0
}
func (s *ReverseTimeDeltaCompressor) Append(unixtime uint32) {
if s.lastUnixtime > 0 {
@@ -154,7 +159,7 @@ type TimeDeltaBound struct {
}
// delta h
func (s *ReverseTimeDeltaCompressor) GetState() TimeDeltaBound {
func (s *ReverseTimeDeltaCompressor) GetState() TimeDeltaBound { // fix replace by Lock
bound := TimeDeltaBound{
LastUnixtime: s.lastUnixtime,
}
@@ -166,6 +171,24 @@ func (s *ReverseTimeDeltaCompressor) GetState() TimeDeltaBound {
return bound
}
func (s *ReverseTimeDeltaCompressor) Lock() {
// fix
}
func (s *ReverseTimeDeltaCompressor) Unlock() {
//s.state = nil // fix
}
func (s *ReverseTimeDeltaCompressor) Renew() {
// s.buf = conbuf.New(nil)
// s.pos = 0
// //
// s.baseValue = 0
// s.lastDelta = 0
// s.lastDeltaSize = 0
// s.h = 0
}
// DECOMPRESSOR
type ReverseTimeDeltaDecompressor struct {