frc5183 / Oatmeal

MIT License
2 stars 0 forks source link

refactor(src/main/java/wtf/triplapeeck/oatmeal): Removes JSON Database #13

Closed Trip-kun closed 10 months ago

Trip-kun commented 10 months ago

Reminders moved to their own table; Better, less expensive iteration used.

Summary by CodeRabbit

coderabbitai[bot] commented 10 months ago

[!WARNING]

Rate Limit Exceeded

@Trip-kun has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 0 minutes and 42 seconds before requesting another review.

How to resolve this issue? After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.
How do rate limits work? CodeRabbit enforces hourly rate limits for each developer per repository. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.
Commits Files that changed from the base of the PR and between 0c2b85a14fc6f73490d044b9c03fc6710b574dcb and 255f1e64c941dded7c83e3236d8dc0e8d2813f5a.

Walkthrough

The changes in the oatmeal project involve a significant refactoring of the reminder system. The system has been migrated from using JSON-based storage to a MariaDB-based storage. This migration required the removal of the DataMode and related JSON storage classes. Instead, new MariaDB entities and methods have been introduced to handle reminder data. The reminder functionality has been updated across various classes to accommodate these changes. Overall, these changes improve the efficiency and scalability of the reminder system in the project.

Changes

File(s) Summary
src/main/java/wtf/triplapeeck/oatmeal/Config.java Removed DataMode import and variable. dataMode field is no longer used.
src/main/java/wtf/triplapeeck/oatmeal/Main.java Removed DataMode and JSONStorableFactory imports. Always initializes dataManager as MariaManager.
src/main/java/wtf/triplapeeck/oatmeal/commands/CommandHandler.java Removed GenericData and GenericJSONStorable imports and usage.
src/main/java/wtf/triplapeeck/oatmeal/commands/miscellaneous/Remind.java Added ReminderData and Main imports. Updated saving of reminder data and message sent in the channel.
src/main/java/wtf/triplapeeck/oatmeal/entities/ReminderData.java Introduced new abstract class for reminder data.
src/main/java/wtf/triplapeeck/oatmeal/entities/UserData.java Removed getReminders() and setReminders() methods.
src/main/java/wtf/triplapeeck/oatmeal/entities/mariadb/MariaReminder.java Introduced new class for MariaDB-based reminder entity.
src/main/java/wtf/triplapeeck/oatmeal/entities/mariadb/MariaUser.java Removed reminder functionality from MariaUser class.
src/main/java/wtf/triplapeeck/oatmeal/managers/DataManager.java Removed genericCache. Added new methods for reminder management.
src/main/java/wtf/triplapeeck/oatmeal/managers/MariaManager.java Added ReminderData import. Updated methods for reminder management.
src/main/java/wtf/triplapeeck/oatmeal/runnable/Heartbeat.java Removed GenericData, UserData, and GenericJSONStorable imports. Updated reminder handling logic.
src/main/java/wtf/triplapeeck/oatmeal/runnable/NewTable.java Removed ChannelJSONStorable import and related variable.
src/main/java/wtf/triplapeeck/oatmeal/runnable/TableUpdate.java Updated imports and removed ClosedStorableError exception handling.
src/main/java/wtf/triplapeeck/oatmeal/util/ConfigParser.java Removed DataMode import and related method.
src/main/java/wtf/triplapeeck/oatmeal/util/DatabaseUtil.java Added List import and introduced new methods for reminder entity management.

Poem

🍂 As autumn leaves fall, so does old code retire, 🍁

Replaced by new lines, that the project does require. 📝

From JSON to MariaDB, reminders now flow, 🔄

Like rivers of data, in the moon's gentle glow. 🌙

Celebrate the changes, for they bring us delight, 🎉

As we code through the day, and debug through the night. 💻

So here's to the coders, in every nation, 🌍

Making the world better, through their dedication. 🙌


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - If you reply to a *review comment* from CodeRabbit, the bot will automatically respond. - To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment - Note: Review comments are made on code diffs or files, not on the PR overview. - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai help` to get help. - `@coderabbitai resolve` to resolve all the CodeRabbit review comments. Note: For conversation with the bot, please use the review comments on code diffs or files. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`
Baconing commented 10 months ago

We don't need to keep "Maria" entities separate/named differently because ORMLite supports a wide range of JDBC based databases, automatically filling in the cracks for any Entity annotated correctly.

However, more importantly, the responsibility of ensuring Entities are processed correctly for the database type falls on the database implementation and provider, not the entity.

As this commit is just about removing the JSON system, it is not an issue as of now, but something to consider in the future.