-
Notifications
You must be signed in to change notification settings - Fork 136
IGNITE-17424 Basic C++ client #1085
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
Conversation
|
General note on async APIs Currently, the APIs are based on
Basically, we can only perform a blocking wait or some kind of busy loop wait. I think a callback-based API is a better alternative (user can pass a callback that will be invoked upon completion).
Example: Asio library with callbacks, futures, coroutines (awaitables) |
| auto pool = m_pool; | ||
| if (pool) | ||
| pool->stop(); |
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.
| auto pool = m_pool; | |
| if (pool) | |
| pool->stop(); | |
| if (auto pool = m_pool) | |
| pool->stop(); |
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.
Come on, this is not an error :)
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.
yes, just a suggestion, you may ignore it
| return; | ||
| } | ||
| else if (it != m_connections.end()) | ||
| connection = it->second; |
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.
Any reaction if the connection not found? Perhaps write something to log at least?
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 a normal situation actually. Connection could be closed before we handle a received message.
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.
Ok. Perhaps write a comment?
| else if (it != m_connections.end()) | ||
| connection = it->second; | ||
| } | ||
|
|
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 makes 2 locks on every message. This is not going to scale well. Especially, if I got it correct, considering that after the handshake is done, for all of the following messages these locks are practically useless.
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.
You are right. I'll try to fix it.
| * @return TableImpl with corresponding name. | ||
| * @throw IgniteError In case of error. | ||
| */ | ||
| void getTableAsync(const std::string& name, IgniteCallback<std::optional<Table>> callback); |
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.
Are we going to have more methods here? And more fields? Currently this class looks excessive. We can move this method (and any methods like this that use only m_connection) directly to ClusterConnection.
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.
Sure. This is an entry point for table management API. There are going to be such methods as createTable, updateTable, dropTable, etc. Currently there are very few methods in user API overall but thats just to not inflate PR which is big enough already.
modules/platforms/cpp/network/include/ignite/network/data_buffer.h
Outdated
Show resolved
Hide resolved
ademakov
left a comment
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
Done:
schemalib. To be done in another ticket once we decide on a common code style.