wp
This commit is contained in:
88
qb.go
Normal file
88
qb.go
Normal file
@@ -0,0 +1,88 @@
|
||||
package qb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
type MetricType byte
|
||||
type GroupBy byte
|
||||
|
||||
const (
|
||||
Cumulative MetricType = 1
|
||||
Instant MetricType = 2
|
||||
MaxFracDigits byte = 7
|
||||
|
||||
GroupByHour GroupBy = 1
|
||||
GroupByDay GroupBy = 2
|
||||
GroupByMonth GroupBy = 3
|
||||
|
||||
AggregateMin byte = 1
|
||||
AggregateMax byte = 2
|
||||
AggregateAvg byte = 4
|
||||
)
|
||||
|
||||
type TimestampCompressor interface {
|
||||
CalcRequiredSpace(uint32) int
|
||||
Append(uint32)
|
||||
Size() int
|
||||
DeleteLast()
|
||||
//LastTimestamp() uint32
|
||||
}
|
||||
|
||||
type ValueCompressor interface {
|
||||
CalcRequiredSpace(float64) int
|
||||
Append(float64)
|
||||
Size() int
|
||||
DeleteLast()
|
||||
//LastValue() float64
|
||||
}
|
||||
|
||||
type TimestampDecompressor interface {
|
||||
NextValue() (uint32, bool)
|
||||
}
|
||||
|
||||
type ValueDecompressor interface {
|
||||
NextValue() (float64, bool)
|
||||
}
|
||||
|
||||
type AbortCode int
|
||||
|
||||
const (
|
||||
// Fatal errors
|
||||
WrongPrevPageNo AbortCode = 1
|
||||
WriteToAtreeFailed AbortCode = 2
|
||||
MaxAtreeSizeExceeded AbortCode = 3
|
||||
FailedWriteToTxLog AbortCode = 4
|
||||
ReferenceCountBug AbortCode = 5
|
||||
WrongResultCodeBug AbortCode = 6
|
||||
RemoveREDOFileFailed AbortCode = 7
|
||||
FailedAtreeRequest AbortCode = 8
|
||||
UnknownTxLogRecordTypeBug AbortCode = 11
|
||||
HasTimestampNoValueBug AbortCode = 12
|
||||
NoMetricBug AbortCode = 13
|
||||
NoLockEntryBug AbortCode = 14
|
||||
NoXLockBug AbortCode = 15
|
||||
MetricAddedBug AbortCode = 16
|
||||
NoRLockBug AbortCode = 17
|
||||
XLockBug AbortCode = 18
|
||||
FailedFreeListSerialize AbortCode = 19
|
||||
UnknownWorkerQueueItemBug AbortCode = 20
|
||||
UnknownMetricWaitQueueItemBug AbortCode = 21
|
||||
//
|
||||
GetRecoveryRecipeFailed AbortCode = 26
|
||||
LoadSnapshotFailed AbortCode = 27
|
||||
ReplayChangesFailed AbortCode = 28
|
||||
CreateChangesWriterFailed AbortCode = 29
|
||||
RemoveRecipeFileFailed AbortCode = 30
|
||||
DumpSnapshotFailed AbortCode = 31
|
||||
SearchREDOFilesFailed AbortCode = 32
|
||||
ReplayREDOFileFailed AbortCode = 33
|
||||
DeletePrevChangesFileFailed AbortCode = 34
|
||||
DeletePrevSnapshotFileFailed AbortCode = 35
|
||||
)
|
||||
|
||||
func Abort(code AbortCode, err error) {
|
||||
fmt.Println(err)
|
||||
os.Exit(int(code))
|
||||
}
|
||||
Reference in New Issue
Block a user