-
Notifications
You must be signed in to change notification settings - Fork 549
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
Storage rewrite - Phase 1 #4065
Conversation
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/4065/de9dd204
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't reviewed all, will continue in the next days. Still left some comments on what I went over
@Nonnull | ||
public PlayerProfile getOwner() { | ||
return profile; | ||
return profile != null ? profile : PlayerProfile.find(Bukkit.getOfflinePlayer(ownerId)).orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is jank and I know, but seeing orElse(null)
in a @Nonnull
method makes my eyes bleed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same but not sure how else to keep compatibility here haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe orElseThrow
to keep the nonnull contract and give some info in an error if this somehow fails?
src/main/java/io/github/thebusybiscuit/slimefun4/storage/backend/legacy/LegacyStorage.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java
Outdated
Show resolved
Hide resolved
Config playerFile = new Config("data-storage/Slimefun/Players/" + uuid + ".yml"); | ||
// Not too sure why this is it's own file | ||
Config waypointsFile = new Config("data-storage/Slimefun/waypoints/" + uuid + ".yml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we extract these and make them class variables? They are used in both load and save, and the first one is still referenced in PlayerProfile.java just for a getter that I see, and who knows if they are elsewhere that I have yet to see or can't remember. Sounds more robust to just have them be in one place, or is there a reason to keep them elsewhere too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit awkward since they rely on a UUID. I could put the string as a global and format but it's only used twice in here so wasn't the biggest fan of that.
This API isn't great and not really expandable so I plan to work on figuring out how that should look post this PR. Once that is done, we may be able to globalise in some way. Not sure how yet.
src/main/java/io/github/thebusybiscuit/slimefun4/storage/backend/legacy/LegacyStorage.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/Waypoint.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/storage/data/PlayerData.java
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
If its easier to manage we should keep it out of PlayerProfile. No reason to make our own lifes harder
If its handled correctly no if its not yes.
We might need some examples of servers with mass use of backpacks to answer this.
On phase 3 we mark the new backend as stable for playerprofile. then the quesiton should we enable it by default for the servers is yes this shouldnt be a maybe otherwise we arent going into phase 3. I agree otherwise with the steps. General question. |
Imo, this is a question we'll ask ourselves on a case by case basis. I think for this one, not needed. BS phase, maybe since it's so massive. This one should be easy to spot the bugs coming from this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM i think we should move to phase 2
Agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some painful things but discussed in DMs and they're fine. LGTM
Walked through everything again and it seems to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if what I mentioned should be "gating" changes so just doing comment
src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/storage/data/PlayerData.java
Show resolved
Hide resolved
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 34 New issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, if I missed anything it would be on the tests but I think it's good 😅
Description
Ok... bear with me on this!
This PR is the start of our new storage layer. Famously known as the "BlockStorage rewrite" or "SQL for player data".
This PR goes over the goals, and how we get there and starts implementation of phase 1.
Please read through the whole ADR as that describes the goal that I'm going for here.
Please review and comment on the ADR as well as the code being done here.
This PR is mainly about kicking things off, sharing the direction/goal and starting the process. It is not about implementing the API, the additional backends or anything else. The API seen in this PR is a bare minimum and will change to be more inline with what we will probably go for going forward.
Proposed changes
Related Issues (if applicable)
N/A
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null valuesOpen questions
Testing
This PR focuses on the PlayerProfile and associated data. Therefore, we'd like testing on: