storj/satellite
Jessica Grebenschikov 4a2c66fa06 satellite/accounting: add cache for getting project storage and bw limits
This PR adds the following items:
1) an in-memory read-only cache thats stores project limit info for projectIDs

This cache is stored in-memory since this is expected to be a small amount of data. In this implementation we are only storing in the cache projects that have been accessed. Currently for the largest Satellite (eu-west) there is about 4500 total projects. So storing the storage limit (int64) and the bandwidth limit (int64), this would end up being about 200kb (including the 32 byte project ID) if all 4500 projectIDs were in the cache. So this all fits in memory for the time being. At some point it may not as usage grows, but that seems years out.

The cache is a read only cache. When requests come in to upload/download a file, we will read from the cache what the current limits are for that project. If the cache does not contain the projectID, it will get the info from the database (satellitedb project table), then add it to the cache.

The only time the values in the cache are modified is when either a) the project ID is not in the cache, or b) the item in the cache has expired (default 10mins), then the data gets refreshed out of the database. This occurs by default every 10 mins. This means that if we update the usage limits in the database, that change might not show up in the cache for 10 mins which mean it will not be reflected to limit end users uploading/downloading files for that time period..

Change-Id: I3fd7056cf963676009834fcbcf9c4a0922ca4a8f
2020-09-25 16:28:49 +00:00
..
accounting satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
admin satellite/satellitedb: makes limits nullable change backwards compatible 2020-09-23 17:54:42 +02:00
attribution all: fix dots 2020-07-16 14:58:28 +00:00
audit satellite/metainfo: replace ScopedPath with metabase.SegmentLocation 2020-09-04 10:06:52 +00:00
compensation all: add missing dots 2020-08-11 17:50:01 +03:00
console satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
contact all: fix dots 2020-07-16 14:58:28 +00:00
dbcleanup satellite/dbcleanup: run cleanup more frequently 2020-06-10 18:32:15 +00:00
downtime all: fix comments 2020-07-16 19:13:14 +03:00
gc satellite/metainfo: replace ScopedPath with metabase.SegmentLocation 2020-09-04 10:06:52 +00:00
gracefulexit satellite/gracefulexit: replace Path []byte to `Key 2020-09-04 11:09:48 +00:00
inspector satellite/metainfo: use metabase.SegmentKey with metainfo.Service 2020-09-03 15:11:32 +00:00
mailservice all: fix dots 2020-07-16 14:58:28 +00:00
marketingweb all: fix dots 2020-07-16 14:58:28 +00:00
metainfo satellite: make limits be nullable 2020-09-21 19:34:19 +00:00
metrics satellite/metainfo: replace ScopedPath with metabase.SegmentLocation 2020-09-04 10:06:52 +00:00
nodeapiversion satellite/nodeapiversion: new table for tracking node api usage 2020-07-09 15:02:25 +00:00
nodeselection all: add missing dots 2020-08-11 17:50:01 +03:00
nodestats storagenode/reputation: offline_under_review_at added 2020-09-02 18:48:28 +03:00
orders satellite/orders: don't version check old endpoint 2020-09-09 10:23:48 -04:00
overlay satellite/satellitedb: uses vetted_at field to select for reputable nodes 2020-09-04 16:45:32 +00:00
payments satellite/satellitedb: makes limits nullable change backwards compatible 2020-09-23 17:54:42 +02:00
referrals all: fix dots 2020-07-16 14:58:28 +00:00
repair satellite/repair: use metabase.SegmentKey type in repair package 2020-09-08 19:35:20 +00:00
revocation all: fix dots 2020-07-16 14:58:28 +00:00
rewards Adding Kesque, MSP360, Innovoedge, Taloflow, Restic partners (#3933) 2020-08-27 14:29:54 -04:00
satellitedb satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
snopayout storagenode: heldamount renamed to payouts, renamed some methods and structs to more meaningful names. grouped estimated payout with pathouts 2020-09-16 14:57:35 +00:00
admin.go satellite/console: make paywall optional 2020-07-28 10:57:49 +00:00
api.go satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
config-lock_test.go satellite: add Go test version of satellite-config-lock tests 2020-05-13 08:14:24 +00:00
core.go satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
gc.go all: fix dots 2020-07-16 14:58:28 +00:00
peer.go satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
repairer.go satellite/orders: add bucket id to order limit 2020-09-03 10:50:11 +03:00