Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("emission service")
Error describes internal emission service error.
Functions ¶
This section is empty.
Types ¶
type CalculationInput ¶ added in v1.99.1
type CalculationInput struct { AmountOfDataInTB float64 // The amount of data in terabytes or terabyte-duration. Duration time.Duration // The Duration over which the data is measured. IsTBDuration bool // true if AmountOfDataInTB is in terabytes-duration, false if in terabytes. }
CalculationInput holds input data needed to perform emission impact calculations.
type Config ¶
type Config struct { WriteEnergy float64 `help:"energy needed to write 1GB of data, in W-hours/GB" default:"0.005"` CO2PerEnergy float64 `help:"amount of carbon emission per unit of energy, in kg/kW-hours" default:"0.2826"` ShortenedDriveLife float64 `help:"shortened hard drive life period, in years" default:"3"` StandardDriveLife float64 `help:"standard hard drive life period, in years" default:"4"` ExtendedDriveLife float64 `help:"extended hard drive life period, in years" default:"6"` NewDriveEmbodiedCarbon float64 `help:"carbon footprint of producing 1TB HDD, in kg/TB" default:"20"` CarbonFromDrivePowering float64 `help:"carbon from power per year of operations, in kg/TB-year" default:"15.9"` RepairedData float64 `help:"amount of repaired data, in TB" default:"667"` ExpandedData float64 `help:"amount of expanded data, in TB" default:"48689"` StorjGCPCarbon float64 `help:"amount of carbon emission from storj GCP, in kg" default:"3600"` StorjCRDBCarbon float64 `help:"amount of carbon emission from storj CRDB, in kg" default:"2650"` StorjEdgeCarbon float64 `help:"amount of carbon emission from storj Edge, in kg" default:"10924"` StorjExpandedNetworkStorage float64 `help:"amount of expanded network storage, in TB" default:"18933"` HyperscalerExpansionFactor float64 `help:"expansion factor of hyperscaler networks" default:"3"` CorporateDCExpansionFactor float64 `help:"expansion factor of corporate data center networks" default:"4"` StorjExpansionFactor float64 `help:"expansion factor of storj network" default:"2.7"` HyperscalerRegionCount float64 `help:"region count of hyperscaler networks" default:"2"` CorporateDCRegionCount float64 `help:"region count of corporate data center networks" default:"2"` StorjRegionCount float64 `help:"region count of storj network" default:"1"` StorjStandardNetworkWeighting float64 `help:"network weighting of already provisioned, powered drives, in fraction" default:"0.21"` StorjNewNetworkWeighting float64 `help:"network weighting of new nodes, in fraction" default:"0.582"` HyperscalerUtilizationFraction float64 `help:"utilization fraction of hyperscaler networks, in fraction" default:"0.75"` CorporateDCUtilizationFraction float64 `help:"utilization fraction of corporate data center networks, in fraction" default:"0.40"` StorjUtilizationFraction float64 `help:"utilization fraction of storj network, in fraction" default:"0.85"` AverageCO2SequesteredByTree float64 `help:"weighted average CO2 sequestered by a medium growth coniferous or deciduous tree, in kgCO2e/tree" default:"60"` }
Config contains configurable values for emission service.
type Impact ¶
type Impact struct { EstimatedKgCO2eStorj float64 EstimatedKgCO2eHyperscaler float64 EstimatedKgCO2eCorporateDC float64 EstimatedFractionSavingsAgainstHyperscaler float64 EstimatedFractionSavingsAgainstCorporateDC float64 }
Impact represents emission impact from different sources.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an emission service. Performs emissions impact calculations.
architecture: Service
func NewService ¶
NewService creates a new Service with the given configuration.
func (*Service) CalculateImpact ¶
func (sv *Service) CalculateImpact(input *CalculationInput) (*Impact, error)
CalculateImpact calculates emission impact coming from different sources e.g. Storj, hyperscaler or corporateDC.
func (*Service) CalculateSavedTrees ¶ added in v1.99.1
CalculateSavedTrees calculates saved trees count based on emission impact.
type Unit ¶ added in v1.99.1
type Unit struct {
// contains filtered or unexported fields
}
Unit represents a set of unit dimensions. Unit{byte: 0, watt: 0, hour: 1, kilogram: 0} means hour (H). Unit{byte: 1, watt: 0, hour: -1, kilogram: 0} means byte/hour (B/H). Unit{byte: -1, watt: 0, hour: -1, kilogram: 1} means kg/byte-hour (kg/B*H).
type Val ¶
Val represents a value which consists of the numeric value itself and it's dimensions e.g. 1 W. It may be used to represent a really complex value e.g. 1 W / H or 0.005 W * H / B.
func (Val) Div ¶
Div divides one Val by a given one and returns new Val. It adjusts both the amount and the dimensions accordingly.