DataStores and resetting the RS

in #utopian-io6 years ago (edited)

For what project is this:

This a Post which talks about the introduction of the DataStores and the capability of Resets to the RS.

Resetting the RS and its problems

When I initially introduced the RS a couple of months ago, there was one flaw with it: Its data was distributed over several classes and several places inside those classes, all losely coupled using ITokens.
This was a problem when something broke. So I decided to change it.

A central database here we go:

Using our factory systems and a simple Map I was quickly able to create a nice central storage for our SRM:
image.png
This storage is now the central place were the RS stores data that it needs, I gave it an endpoint in its API:
image.png

Getting data:

Now that we have a central place to store the Data. We need a way to get it out. To make this possible we make use of TypeTokens (Google GenericType catchers) and again ITokens to identify which store we are looking for. As you can see the StandardDataStoreManager, will create a DataStore if it is not already known using our factory system:
image.png

Resetting the RS.

Now that we have all our ducks in a row so to speak resetting the RS to its defaults was easy as this:
image.png
We resetup our SRM to create a new DataStoreManager and to get new ITokens for the respective datastores:
image.png
After that we run our SRM Update logik to register all components back into it again.
Done.

Now it is possible to use a single command to reset the RS, incase it breaks, without having to dig through several NBT files that Minecolonies uses.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because we have already accepted the same Pull Request in your previous contribution.

You can contact us on Discord.
[utopian-moderator]

Bless up.... You're excelling

Nice

And good post also

so thankful of ur post... i have upvoted ur post please do upvote my post once please

Congratulations @oriononline, this post is the tenth most rewarded post (based on pending payouts) in the last 12 hours written by a Dust account holder (accounts that hold between 0 and 0.01 Mega Vests). The total number of posts by Dust account holders during this period was 18613 and the total pending payments to posts in this category was $6514.34. To see the full list of highest paid posts across all accounts categories, click here.

If you do not wish to receive these messages in future, please reply stop to this comment.

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64093.86
ETH 3123.80
USDT 1.00
SBD 3.94