Skip to content

Support storage limits #41

@tahpot

Description

@tahpot

Support storage nodes setting a storage limit per user's application context and limiting the maximum number of users they support.

This will enable user's to pre-purchase specific amounts of storage capacity that will be enforced by storage nodes.

This can be enforced by checking the storage limit at the following endpoints:

  • /user/createDatabase
  • /user/updateDatabase
  • /auth/connect

This allows a user to obtain a refresh token, but not an access token. The user can also delete databases, but can't create or update them.

Tasks:

  • /auth/authenticate will be updated to set a default per user storage limit
  • .env will be updated to specify the default storage limit for new users (10Mb default)
  • /user/usage will be updated to include the user's storage limit (in bytes) and utilization percentage
  • _users collection will store a new field storageLimit which is the maximum size in bytes the user can store
  • Enforce limit /user/createDatabase
  • Enforce limit /user/updateDatabase
  • Enforce limit /auth/connect
  • .env will be updated to specify the maximum number of users (10,000 default) for the node
  • Throw an error if attempting to create a new user and the maximum number of users has been hit
  • Create an endpoint /status that outputs (current version, maximum user count, current user count)

Note: A user could exceed the storage limit during a given session, but there's no point as once their access token expires they will no longer have access to the data.

Note: A "user" is actually a combination of DID and application context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions