Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // B is a Val constructor function with byte (B) dimension. B = ValMaker(byteLabel) // KB is a Val constructor function with kilobyte (KB) dimension. KB = B(decimalMultiplier).Maker() // MB is a Val constructor function with megabyte (MB) dimension. MB = KB(decimalMultiplier).Maker() // GB is a Val constructor function with gigabyte (GB) dimension. GB = MB(decimalMultiplier).Maker() // TB is a Val constructor function with terabyte (TB) dimension. TB = GB(decimalMultiplier).Maker() // W is a Val constructor function with watt (W) dimension. W = ValMaker(wattLabel) // H is a Val constructor function with hour (H) dimension. H = ValMaker(hourLabel) // Y is a Val constructor function with year (Y) dimension. Y = H(dayHours * yearDays).Maker() )
var Error = errs.Class("emission service")
Error describes internal emission service error.
var Q = ValMaker("")
Q is a Val constructor function without any dimension.
Functions ¶
Types ¶
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"` }
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.
type Val ¶
Val represents a value which consists of the numeric value itself and it's dimensions e.g. 1 kW. It may be used to represent a really complex value e.g. 1 kW / H or 0.005 W * H / GB.
func (*Val) Div ¶
Div divides one Val by a given one and returns new Val. It adjusts both the amount and the dimensions accordingly. Q := ValMaker("") - Q is a constructor function which has no dimension. Q(0.005) returns 0.005 Val. Q(0.005).Mul(W(1)) means 0.005 * 1 W = 0.005 W. Q(0.005).Mul(W(1)).Div(H(1)) means 0.005 * 1 W / 1 H = 0.005 W / 1 H = 0.005 W / H.
func (*Val) Maker ¶
Maker creates a new Val constructor function from already existing Val. This is used to handle dimension factor differences. B := ValMaker("B") - B is a constructor function here. B(1) returns 1 byte Val. KB := B(1000).Maker() returns a construction function for a KB value. KB(1) returns 1 kilobyte Val but under the hood it's still 1000 B value.
func (*Val) Mul ¶
Mul multiplies existing Val with a given one and returns new Val. It adjusts both the amount and the dimensions accordingly. Q := ValMaker("") - Q is a constructor function which has no dimension. Q(0.005) returns 0.005 Val. Q(0.005).Mul(W(1)) means 0.005 * 1 W = 0.005 W. Q(0.005).Mul(W(1)).Mul(H(1)) means 0.005 * 1 W * 1 H = 0.005 W * 1 H = 0.005 W * H.
func (*Val) String ¶
String returns string representation of the Val. Q := ValMaker("") - Q is a constructor function which has no dimension. Q(0.005).String is just 0.005. Q(0.005).Mul(W(1)).Mul(H(1)).Div(MB(1)).String() is 0.005 W * H / MB. KB(1).String() returns 1000 B because KB Val was created from a B Val.