-
Notifications
You must be signed in to change notification settings - Fork 111
Resumable-friendly external database drivers embedding API & PDO::MySQL resumable basic version #393
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
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
1eaecff to
0ce100f
Compare
36a7cd1 to
7e4c4ae
Compare
24345e2 to
ed41a39
Compare
8cda7c7 to
56033de
Compare
d8b5af8 to
8980f64
Compare
939c1de to
033e906
Compare
f61e257 to
101bd86
Compare
drdzyk
reviewed
Feb 15, 2022
6bd7e02 to
21b79ab
Compare
drdzyk
previously approved these changes
Feb 16, 2022
905a82d to
83d2d65
Compare
drdzyk
previously approved these changes
Feb 17, 2022
83d2d65 to
88c5f6e
Compare
troy4eg
approved these changes
Feb 17, 2022
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.
The main goal of the PR is to introduce internal resumable-friendly API for embedding asynchronous database drivers (MySQL, PostgreSQL, Redis etc.)
Resumable-friendly means that any network communication based on this API will be considered as a suspendable point by KPHP resumable functions (a.k.a. coroutines). To achieve this the API deeply interacts with KPHP web server network internals and epoll reactor.
The API provides the following abstractions:
database_drivers::Connector-- class representing connection to database.Specific database driver is supposed to extend this class and implement all pure virtual methods.
The most important of them:
See all such methods at
server/database-drivers/connector.hdatabase_drivers::Request-- class representing request to database. It has the only method for sending itself asynchronously:Should be called from
database_drivers::Connector::handle_write()database_drivers::Response-- class representing response from database. It has the only method for fetching itself asynchronously:Should be called from
database_drivers::Connector::handle_read()And special singleton class to manipulate these abstractions -
database_drivers::Adaptor. With it you can:server/database-drivers/adaptor.hAs an example of usage this API, basic resumable PDO::MySQL version is implemented in this PR as well.
It supports only basic read and modify operations with default behaviour. But these operations are truly resumable thanks to new API.