Module Tezos_oxymeter.Report
Utility used by the entire library to represent a report. Once it's created, it can't be ereased.
Representation
A report is a representation of the state of an Observer.observer at a given time.
type tAbstract representation for a report. To get the content, it's recommanded to use the encoding system.
val create : ?joule:float -> ?volt:float -> ?ampere:float -> ?power:float -> ?watt_hour:float -> float -> tcreatebuilds a report with the information provide.Usage:
create ~joule ~volt ~ampere ~power ~watt_hour timejouleis the instant energy (default is 0).voltrepresents the voltage (default is 0).ampererepresents the intensity (default is 0).powerrefers to the power consumption (default is 0).watt_houris the energy per time consumption (default is 0).timeis a UNIX timestamp.
Manipulation
Even if the t type is immutable, you can execute some actions on it and generates new reports.
val diff : t -> t -> tdiff r1 r2creates a new report which represents the difference between the two reports (r1 - r2), field by field.
val pp : Stdlib.Format.formatter -> t -> unitpp ppf reportis used to pretty print the report.
Conversion
The report can convert to various to be:
- send through the network
- print as a string
- use as a normalize representation
val encoding : t Data_encoding.tIt provides an encoding used by tezos to transform data in JSON format.