storj/storagenode/storagenodedb
Jeff Wendling 91698207cf storagenode: live tracking of order window usage
This change accomplishes multiple things:

1. Instead of having a max in flight time, which means
   we effectively have a minimum bandwidth for uploads
   and downloads, we keep track of what windows have
   active requests happening in them.

2. We don't double check when we save the order to see if it
   is too old: by then, it's too late. A malicious uplink
   could just submit orders outside of the grace window and
   receive all the data, but the node would just not commit
   it, so the uplink gets free traffic. Because the endpoints
   also check for the order being too old, this would be a
   very tight race that depends on knowledge of the node system
   clock, but best to not have the race exist. Instead, we piggy
   back off of the in flight tracking and do the check when
   we start to handle the order, and commit at the end.

3. Change the functions that send orders and list unsent
   orders to accept a time at which that operation is
   happening. This way, in tests, we can pretend we're
   listing or sending far into the future after the windows
   are available to send, rather than exposing test functions
   to modify internal state about the grace period to get
   the desired effect. This brings tests closer to actual
   usage in production.

4. Change the calculation for if an order is allowed to be
   enqueued due to the grace period to just look at the
   order creation time, rather than some computation involving
   the window it will be in. In this way, you can easily
   answer the question of "will this order be accepted?" by
   asking "is it older than X?" where X is the grace period.

5. Increases the frequency we check to send up orders to once
   every 5 minutes instead of once every hour because we already
   have hour-long buffering due to the windows. This decreases
   the maximum latency that an order will be reported back to
   the satellite by 55 minutes.

Change-Id: Ie08b90d139d45ee89b82347e191a2f8db1b88036
2020-08-19 19:42:33 +00:00
..
storagenodedbtest storagenode/piecestore: switch usedserials db for in-memory usedserials store 2020-05-28 12:52:52 -04:00
testdata all: fix dots 2020-07-16 14:58:28 +00:00
bandwidthdb.go all: fix dots 2020-07-16 14:58:28 +00:00
database.go storagenode/storagenodedb: database name in all preflight errors 2020-08-18 16:31:19 +03:00
db_container.go private/dbutil/txutil: create new transactions for retries 2020-02-01 18:34:28 +00:00
deprecatedinfo.go storagenodedb: reenable utccheck in tests 2019-12-10 23:17:14 +00:00
heldamount.go all: fix error checking 2020-07-16 19:13:14 +03:00
migrations_test.go all: fix dots 2020-07-16 14:58:28 +00:00
notifications.go all: simplify uuid usage 2020-04-02 05:48:58 +00:00
orders.go storagenode: live tracking of order window usage 2020-08-19 19:42:33 +00:00
pieceexpiration.go all: fix dots 2020-07-16 14:58:28 +00:00
pieceinfo.go all: fix dots 2020-07-16 14:58:28 +00:00
piecespaceused.go all: fix dots 2020-07-16 14:58:28 +00:00
pricing.go all: replace == comparison with errors.Is 2020-07-14 15:50:25 +00:00
reputation.go all: fix dots 2020-07-16 14:58:28 +00:00
satellites.go all: fix dots 2020-07-16 14:58:28 +00:00
schema.go storagenode/heldamount: payents added to db 2020-06-30 17:24:35 +03:00
schemagen.go all: rename CreateTables to MigrateToLatest 2020-04-30 07:21:17 +00:00
storageusage.go all: fix dots 2020-07-16 14:58:28 +00:00
usedserials.go storagenode/piecestore: switch usedserials db for in-memory usedserials store 2020-05-28 12:52:52 -04:00