storj/private
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
..
cui all: fix dots 2020-07-16 14:58:28 +00:00
currency private/currency: add strictcsv support to microunit 2020-03-31 14:57:04 -06:00
date all: fix dots 2020-07-16 14:58:28 +00:00
dbutil private/dbutil: set connMaxLifetime to 30 minutes 2020-08-28 18:00:41 +00:00
debugging all: fix dots 2020-07-16 14:58:28 +00:00
lifecycle private/lifecycle: log fatal ending to a runner 2020-09-03 16:54:40 +03:00
migrate all: add missing dots 2020-08-11 17:50:01 +03:00
post all: fix dots 2020-07-16 14:58:28 +00:00
prompt private/prompt: remove dependency to go-prompt 2020-02-25 13:09:41 +02:00
tagsql all: use jackc/pgx in place of lib/pq 2020-07-13 15:54:41 +00:00
testblobs storagenode/{monitor,pieces}, storage/filestore: add loop to check storage directory writability 2020-08-31 21:20:49 +00:00
testplanet satellite/accounting: add cache for getting project storage and bw limits 2020-09-25 16:28:49 +00:00
testrevocation storage/redis/redisserver: simplify redisserver creation 2020-02-11 19:11:57 +00:00
teststorj all: fix dots 2020-07-16 14:58:28 +00:00
testuplink private/testuplink: move tests to uplink 2020-06-01 12:29:21 +02:00
version storagenode/version: notification flow now based on cursor, chore_test added, versioncontrol added to reconfigure. 2020-07-23 14:13:24 +00:00
web private/web: fix ratelimter IP handling 2020-09-05 18:39:49 +02:00