1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-30 07:23:07 +03:00

Client context documentation, refactoring.

This commit is contained in:
Teemu Ollakka
2018-04-27 17:03:09 +03:00
parent 28026ea4fc
commit c1f8f2c37d
10 changed files with 303 additions and 195 deletions

View File

@ -199,3 +199,47 @@ Methods:
* apply()
# Example usage
```
class dbms_server : public trrep::server_context
{
public:
// Implementation
void start()
{
// Initialize server components, start accepting client connections
}
};
class dbms_client : public trrep::client_context
{
// Implementation
};
int main()
{
dbms_server server(name, id);
if (server.sst_before_init())
{
server.start();
server.wait_until_state(trrep::server_context::s_joined);
}
// Initialize dbms code here
if (server.sst_before_init() == false)
{
server.start();
server.wait_until_state(trrep::server_context::s_joined);
}
// Start accepting client connections
server.wait_until_state(trrep::server_context::s_synced);
// Clients can read and write here
}
```