diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2020-01-26 14:11:07 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2020-01-26 14:11:28 -0500 |
commit | 1f5dbbbab170bc7f6dd2d47c7aface716ecb294c (patch) | |
tree | 5b956d920455036b9ae7a675b4e497a76edbb314 /rrdformat/format.go | |
parent | a5cba20c1e3b0956737327ef9214fd2cbc221add (diff) |
wip
Diffstat (limited to 'rrdformat/format.go')
-rw-r--r-- | rrdformat/format.go | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/rrdformat/format.go b/rrdformat/format.go index 0233a5c..7ea15b7 100644 --- a/rrdformat/format.go +++ b/rrdformat/format.go @@ -6,12 +6,9 @@ import ( "encoding/binary" "encoding/xml" "math" -) - -type Unival uint64 -func (u Unival) AsUint64() uint64 { return uint64(u) } -func (u Unival) AsFloat64() float64 { return math.Float64frombits(uint64(u)) } + "git.lukeshu.com/go/librrd/rrdformat/rrdbinary" +) const XMLNS = "https://oss.oetiker.ch/rrdtool/rrdtool-dump.xml" @@ -21,6 +18,40 @@ const XMLNS = "https://oss.oetiker.ch/rrdtool/rrdtool-dump.xml" // javascriptRRD: // rrdFile.js: RRDHeader type Header struct { + Cookie rrdbinary.String `rrdbinary:"size=3" xml:"-"` + Version rrdbinary.String `rrdbinary:"size=4" xml:"version"` + FloatCookie rrdbinary.Float `xml:"-"` + DSCnt rrdbinary.Uint `xml:"-"` + RRACnt rrdbinary.Uint `xml:"-"` + DPDStep rrdbinary.Uint `xml:"step"` + Parameters [10]rrdbinary.Unival `xml:"-"` +} + +type DSDef struct { + DSName rrdbinary.String `rrdbinary:"size=20"` + DSType rrdbinary.String `rrdbinary:"size=20"` + Parameters [10]rrdbinary.Unival +} + +type RRADef struct { + CFName rrdbinary.String `rrdbinary:"size=20"` + RowCnt rrdbinary.Uint + PDPCnt rrdBinary.Uint +} + +type LiveHead struct { + +} + +// rrdtool: +// rrd_format.h: rrd_t One single struct to hold all the others. +type RRD struct { + DSDefs []DSDef + RRADefs []RRADef + LiveHead LiveHead +} + +type Header struct { // identification section Cookie []byte // 4 bytes Version []byte // 4 bytes (eh, we let the \0-terminator decided how long) |