update!: overhauled to align with the sabi-rust - #56
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request represents a major overhaul of the sabi-java framework to align its design and API with the sabi-rust implementation. The changes are comprehensive, touching the core framework interfaces, internal implementation, and error handling mechanisms.
Key Changes Overview
1. Enhanced Transaction Failure Reporting
The PR introduces a sophisticated transaction failure diagnostic system:
TxnFailureReport,TxnFailureCause,TxnFailureRollback,TxnFailureCauseState,TxnFailureRollbackState,TxnFailureRecoveryDataConn#onTxnFailure()method to enable informed recovery decisions2. Error Entry Refactoring (New
ErrEntryClass)Errinstances3. Data Connection Lifecycle Improvements
DataConninterface changes:isCommitted()method replacesshouldForceBack()for clearer semanticsrollback()andpostCommit()now throwErr(previously ignored errors in postCommit)onTxnFailure()method for connections to handle transaction failure notificationsFailToPreCommitDataConn,FailToCommitDataConn,FailToPostCommitDataConn4. Internal Refactoring
Removed components:
DataSrcList→ Replaced withDataSrcManager(ArrayList-based, more efficient)DataConnList→ Replaced withDataConnManager(ArrayList-based with manager responsibilities)New internal components:
DataSrcManager: Manages data source registration and lifecycle with setup ordering supportDataConnManager: Handles data connection management, transaction phases, and failure reportingTxnFailureReportBuilder: Constructs transaction failure reports during failure processing5. DataHub API Enhancements
DataHub(List<String> names)and varargs variant for binding specific global data sourcesSabi.setup(String... names)andSabi.setup(List<String> names)for ordered global setupClassCastExceptionhandling inrun()andtxn()methods6. AsyncGroupImpl Optimization
ArrayList<ErrEntry>7. Documentation Improvements
All public interfaces received comprehensive Javadoc updates:
8. Test Updates
AsyncGroupImplTest: Updated to work with new error entry list APIDataAccTest: Significant refactoring to test new transaction failure reporting mechanismsTechnical Philosophy Alignment
This overhaul brings the Java implementation closer to the Rust implementation by:
isCommitted()) for more precise lifecycle managementImpact
This is a breaking change (hence the commit message "update!") that:
DataConnwith new methodsThe changes maintain the core philosophy of sabi: separating business logic from data access through clean interfaces, while improving the framework's robustness and observability.