From 003ce95627f555be132482d96e392534051c43f6 Mon Sep 17 00:00:00 2001 From: Vitalii Date: Mon, 5 Feb 2024 15:42:07 +0200 Subject: [PATCH] satellite/emission: added config Added configuration for emission service. Issue: https://github.com/storj/storj/issues/6694 Change-Id: I58aa3fffed657cc510ba425fb1edb62f2eb47bba --- satellite/emission/config.go | 32 +++++++++++++ satellite/emission/service.go | 17 +++++++ satellite/peer.go | 3 ++ satellite/satellite-config.yaml.lock | 72 ++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 satellite/emission/config.go create mode 100644 satellite/emission/service.go diff --git a/satellite/emission/config.go b/satellite/emission/config.go new file mode 100644 index 000000000000..4c132c707b70 --- /dev/null +++ b/satellite/emission/config.go @@ -0,0 +1,32 @@ +// Copyright (C) 2024 Storj Labs, Inc. +// See LICENSE for copying information. + +package emission + +// Config contains configurable values for emission service. +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"` +} diff --git a/satellite/emission/service.go b/satellite/emission/service.go new file mode 100644 index 000000000000..3b3c0afad564 --- /dev/null +++ b/satellite/emission/service.go @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Storj Labs, Inc. +// See LICENSE for copying information. + +package emission + +// Service is an emission service. +// Performs emissions impact calculations. +// +// architecture: Service +type Service struct { + config *Config +} + +// NewService creates a new ImpactCalculator with the given configuration. +func NewService(config *Config) *Service { + return &Service{config: config} +} diff --git a/satellite/peer.go b/satellite/peer.go index 3048f51a38a5..85f1b6294ab5 100644 --- a/satellite/peer.go +++ b/satellite/peer.go @@ -43,6 +43,7 @@ import ( "storj.io/storj/satellite/console/userinfo" "storj.io/storj/satellite/contact" "storj.io/storj/satellite/durability" + "storj.io/storj/satellite/emission" "storj.io/storj/satellite/gc/bloomfilter" "storj.io/storj/satellite/gc/piecetracker" "storj.io/storj/satellite/gc/sender" @@ -209,6 +210,8 @@ type Config struct { EmailReminders emailreminders.Config ConsoleDBCleanup dbcleanup.Config + Emission emission.Config + AccountFreeze accountfreeze.Config Version version_checker.Config diff --git a/satellite/satellite-config.yaml.lock b/satellite/satellite-config.yaml.lock index 1a41ddcedd89..972352a939b7 100644 --- a/satellite/satellite-config.yaml.lock +++ b/satellite/satellite-config.yaml.lock @@ -547,6 +547,78 @@ contact.external-address: "" # amount of time before sending second reminder to users who need to verify their email # email-reminders.second-verification-reminder: 120h0m0s +# carbon from power per year of operations, in kg/TB-year +# emission.carbon-from-drive-powering: 15.9 + +# amount of carbon emission per unit of energy, in kg/kW-hours +# emission.co2per-energy: 0.2826 + +# expansion factor of corporate data center networks +# emission.corporate-dc-expansion-factor: 4 + +# region count of corporate data center networks +# emission.corporate-dc-region-count: 2 + +# utilization fraction of corporate data center networks, in fraction +# emission.corporate-dc-utilization-fraction: 0.4 + +# amount of expanded data, in TB +# emission.expanded-data: 48689 + +# extended hard drive life period, in years +# emission.extended-drive-life: 6 + +# expansion factor of hyperscaler networks +# emission.hyperscaler-expansion-factor: 3 + +# region count of hyperscaler networks +# emission.hyperscaler-region-count: 2 + +# utilization fraction of hyperscaler networks, in fraction +# emission.hyperscaler-utilization-fraction: 0.75 + +# carbon footprint of producing 1TB HDD, in kg/TB +# emission.new-drive-embodied-carbon: 20 + +# amount of repaired data, in TB +# emission.repaired-data: 667 + +# shortened hard drive life period, in years +# emission.shortened-drive-life: 3 + +# standard hard drive life period, in years +# emission.standard-drive-life: 4 + +# amount of carbon emission from storj CRDB, in kg +# emission.storj-crdb-carbon: 2650 + +# amount of carbon emission from storj Edge, in kg +# emission.storj-edge-carbon: 10924 + +# amount of expanded network storage, in TB +# emission.storj-expanded-network-storage: 18933 + +# expansion factor of storj network +# emission.storj-expansion-factor: 2.7 + +# amount of carbon emission from storj GCP, in kg +# emission.storj-gcp-carbon: 3600 + +# network weighting of new nodes, in fraction +# emission.storj-new-network-weighting: 0.582 + +# region count of storj network +# emission.storj-region-count: 1 + +# network weighting of already provisioned, powered drives, in fraction +# emission.storj-standard-network-weighting: 0.21 + +# utilization fraction of storj network, in fraction +# emission.storj-utilization-fraction: 0.85 + +# energy needed to write 1GB of data, in W-hours/GB +# emission.write-energy: 0.005 + # set if expired segment cleanup is enabled or not # expired-deletion.enabled: true