package rrdformat import ( "bytes" "encoding" "encoding/binary" "encoding/xml" "math" "git.lukeshu.com/go/librrd/rrdformat/rrdbinary" ) // File format versions: // // For the most part, the layout of the file format hasn't // changed--the version number just indicates which enum members you // need to support. The only parser-breaking change is that the // 0002->0003 transition added a few bytes to the timestamp, in order // to go from second-precision to microsecond-precision. // // - "0005" (added in rrdtool 1.5.0, 2015-04-16) // * added DST_DCOUNTER // * added DST_DDERIVE // * otherwise identical to "0004" // // - "0004" (added in rrdtool 1.3.0, 2008-06-10) // * added MHWPREDICT function // * otherwise identical to "0003" // // - "0003" (added in the unreleased rrdtool 1.1.x in 2003, // present in rrdtool 1.2.0, 2005-04-25) // * last-updated timestamp gained a `long` microsecond component // * otherwise identical to "0002" // // - "0002" (never used by a stable release of rrdtool, but was used // by development versions of 1.1.x 2001-2003) // * added DST_CDEF // * added CF_HWPREDICT // * added CF_SEASONAL // * added CF_DEVPREDICT // * added CF_DEVSEASONAL // * added CF_FAILURES // // - "0001" (the original in rrdtool 1.0.0, 1999-07-15) const XMLNS = "https://oss.oetiker.ch/rrdtool/rrdtool-dump.xml" type RRDValue = rrdbinary.Float 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 Timestamp struct { Sec rrdbinary.Time Usec rrdbinary.Int // signed, but always >= 0 } type PDPPrep struct { LastDS rrdbinary.String `rrdbinary:"size=30"` Scratch [10]rrdbinary.Unival } type CDPPrep struct { Scratch [10]rrdbinary.Unival } type RRAPtr struct { CurRow rrdbinary.Uint } type RRDv0005 = RRDv0004 type RRDv0004 = RRDv0003 type RRDv0003 struct { Header Header DSDefs []DSDef RRADefs []RRADef LastUpdated Timestamp PDPPrep TODO CPDPrep TODO RRAPtr TODO Values []RRDValue } type RRDv0002 = RRDv0001 type RRDv0001 struct { Header Header DSDefs []DSDef RRADefs []RRADef LastUpdated rrdbinary.Timestamp PDPPrep TODO CPDPrep TODO RRAPtr TODO Values []RRDValue }