From 1f5dbbbab170bc7f6dd2d47c7aface716ecb294c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 26 Jan 2020 14:11:07 -0500 Subject: wip --- rrdformat/format.go | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'rrdformat/format.go') 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" @@ -20,6 +17,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 -- cgit v1.2.3