Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/storage: rename module data to storage container #53

Closed
wants to merge 1 commit into from
Closed

Conversation

b1lly
Copy link
Contributor

@b1lly b1lly commented Jul 12, 2019

I'm going to do a bigger refactor to the storage.

The ideas are:

  1. The storage will have n number of StorageContainer instead of ModuleData
  2. Each container, will be referenced by an "index" in the storage instead (e.g StorageKey = Index)
  3. Each StorageContainer will have the ability to be globally set, or partially set.

For instance,

// Update the entire index.
core.storage.set(StorageIndex.GLOBAL, {
   ...
});

// Adds or updates a key in the existing index
core.storage.set(StorageIndex.GLOBAL, 'myKey', { });

// Returns the entire index
core.storage.get('StorageIndex.GLOBAL);

// Returns a key within the index
core.storage.get(StorageIndex.GLOBAL, 'myKey');

I think this will help us organize things better, as well as support the namespacing pattern we've been using. Instead of attaching Namespaces to the index as a string, we just use the keys as the namespace within the index.

So for instance, it would be used like:

core.storage.get(StorageIndex.AUTOCOMPLETE, 'namespace')

Thoughts before I implement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant