storj/private/testplanet
Cameron Ayer 4424697d7f satellite/accounting: refactor live accounting to hold current estimated totals
live accounting used to be a cache to store writes before they are picked up during
the tally iteration, after which the cache is cleared. This created a window in which
users could potentially exceed the storage limit. This PR refactors live accounting to
hold current estimations of space used per project. This should also reduce DB load
since we no longer need to query the satellite DB when checking space used for limiting.

The mechanism by which the new live accounting system works is as follows:

During the upload of any segment, the size of that segment is added to its respective
project total in live accounting. At the beginning of the tally iteration we record
the current values in live accounting as `initialLiveTotals`. At the end of the tally
iteration we again record the current totals in live accounting as `latestLiveTotals`.
The metainfo loop observer in tally allows us to get the project totals from what it
observed in metainfo DB which are stored in `tallyProjectTotals`. However, for any
particular segment uploaded during the metainfo loop, the observer may or may not
have seen it. Thus, we take half of the difference between `latestLiveTotals` and
`initialLiveTotals`, and add that to the total that was found during tally and set that
as the new live accounting total.

Initially, live accounting was storing the total stored amount across all nodes rather than
the segment size, which is inconsistent with how we record amounts stored in the project
accounting DB, so we have refactored live accounting to record segment size

Change-Id: Ie48bfdef453428fcdc180b2d781a69d58fd927fb
2020-01-16 10:26:49 -05:00
..
dir.go private: rename internal to private (#3573) 2019-11-14 21:46:15 +02:00
planet_test.go common: separate repository 2019-12-27 14:11:15 +02:00
planet.go common: separate repository 2019-12-27 14:11:15 +02:00
reconfigure.go common: separate repository 2019-12-27 14:11:15 +02:00
referralmanager.go common: separate repository 2019-12-27 14:11:15 +02:00
rpc_test.go common: separate repository 2019-12-27 14:11:15 +02:00
run_test.go common: separate repository 2019-12-27 14:11:15 +02:00
run.go satellite/accounting: refactor live accounting to hold current estimated totals 2020-01-16 10:26:49 -05:00
satellite.go satellite/accounting: refactor live accounting to hold current estimated totals 2020-01-16 10:26:49 -05:00
storagenode.go satellite/contact; storagenode/preflight: add clock check on startup for storagenode 2020-01-15 15:35:26 +00:00
tlsopts_test.go common: separate repository 2019-12-27 14:11:15 +02:00
uplink_test.go uplink: move to storj.io/uplink (#3746) 2020-01-08 15:40:19 +02:00
uplink.go cmd: rename "scope" flag to "access" 2020-01-10 15:27:53 +00:00
versioning.go private/testplanet: use defaultInterval 2020-01-14 16:07:36 +00:00