@Gorkem thanks, you are right, I am working on globalState and `workspaceState.
This brings the questions how are the settings for user and workspace are handled at the moment?
For user scope we have user preferences.
As about workspace, as far as I know, there is not special storage and a volume is used for such kind of needs.
About globalState and `workspaceState.
globalState
If we want to store globalState between workspaces we have to use Che user preferences (or write another service that shouldn't be Theia specific, but satisfy our requirements)
This has its own pros and cons.
Pros:
- We will share some global plugin data between workspaces (it might share a token or settings, see Cons 3).
Cons:
- A plugin can save any kind and any amount of data there (no limits by specification at all). So, there is a chance we'll have quite big amount of data there, which may slow down some services. Not so good solution imo.
- Memento object is synchronous by specification. It means that we cannot request data by key when needed, but have to download all the data each time when plugin starts. Again, we do not know data size.
- We support different sets of plugins per workspace. But when a user has the same plugin in different workspaces and wants to have different settings for each, this approach will make it impossible (for example, in one workspace it is adopted to maven + java + spring boot, in another - it is set up to work best with nodejs). Also a problem if a user wants to use different tokens(not necessarily github) from different workspaces for the same plugin.
workspaceState
If we need to encrypt workspace state we may store encrypted data inside volume, and store the key in user preferences.
But here we face the same problem with synchronous memento: we need to return requested data immediately, so must decrypt whole database and send the data to each plugin on start (database might be big because it stores workspace data of all the used Theia workspaces) or we may use database that supports decryption and encryption on fly. If I am not mistaken, postgresql should be able to do that, but I think it is overkill to bring postgresql for storing workspace state.
On this step, I am not sure that we need encryption (workspaces (projects) itself are not encrypted).