Storage System
fynntimes opened this issue ยท 9 comments
The storage system in Prison v2.0 was a failure. Serialized files are a nightmare to manage are difficult to edit by end-users. There were other problems with the system too. Consider this scenario: A server that has hundreds of players a day decides to stop and start the server. Prison will go and try to read and load potentially thousands of user files - all at once - and keeping their objects in memory. All at once.
Prison v3.0's storage system should be flexible -- enabling the end-user to pick what kind of storage system is right for their server. This solves the problem as popular servers can use databases, therefore only getting the needed information, when it is needed and not storing it in memory.
Below is the list of storage systems that are planned. Bear in mind that this list is subject to change.
- JSON
- MySQL
- MongoDB
Goal: A storage framework that works with multiple database engines (SQLite, MySQL, MongoDB)
What does each one have in common?
- Get data
- Set data
- Create data
- Delete data
SQL to NoSQL
- Database = Database
- Table = Collection
- Row = Document
Due to time constraints, the storage system planned here is no longer going to be a part of the initial release.
Reopening this, will be doing a JSON-MongoDB hybrid system and introducing SQL support later.
A neat serialization/deserialization system for beans has been created in commit 09d35b6.
The next step is to create a database library that takes the output/input and uses it with this new system.
For the initial release, we're just going to use old-fashioned JSON. In a future release, we may do something fancy with databases, but not now.
As of commit 59301b2 the storage system fully* supports flat file, whether Mongo and SQL are going to be present in the Inital or Future release is currently unknown.