DVS::IServer Class Reference
Last update: 17.04.2023Interface class used to run a dynamic data server in a thread accepting incoming client connections. More...
#include <dvs_server_interface.h>
Public Member Functions | |
IServer ()=default | |
default | |
virtual | ~IServer ()=default |
default | |
IServer (IServer &&)=default | |
default | |
IServer & | operator= (IServer &&)=default |
default | |
IServer (const IServer &)=default | |
support copying | |
IServer & | operator= (const IServer &)=default |
default | |
virtual void | set_options (const std::map< const char *, const char * > &options)=0 |
Set a collection of options on the server. Overwrites previous options See. See Server Options. More... | |
virtual void | set_option (const char *key, const char *value)=0 |
Set a specific option on the server, these are used during startup See See Server Options. More... | |
virtual void | clear_options ()=0 |
Clear all options from the server. | |
virtual bool | running () const =0 |
Check to see if the server is running. More... | |
virtual dvs_ret | get_timestep_count (uint32_t &num_pending, uint32_t &num_complete) const =0 |
return the current number of pending and complete timesteps in the server More... | |
virtual dvs_ret | startup (uint32_t server_number, uint32_t local_ranks)=0 |
Start the server. More... | |
virtual dvs_ret | startup_unthreaded (uint32_t server_number, uint32_t local_ranks)=0 |
Startup a server manually without threads. More... | |
virtual dvs_ret | update ()=0 |
Perform a server update. More... | |
virtual dvs_ret | terminating ()=0 |
Call to begin terminating the server. More... | |
virtual void | shutdown ()=0 |
Shutdown the server, also called on server destruction by DVS::DESTROY_SERVER_INSTANCE() | |
virtual ITransport * | create_transport (const std::string &shared_secret)=0 |
Create a transport object to communicate with server, must be destroyed. More... | |
virtual const char * | get_uri ()=0 |
Get URI of this server. More... | |
Detailed Description
Interface class used to run a dynamic data server in a thread accepting incoming client connections.
Usage:
1.) Instantiate DVS::IServer using DVS::CREATE_SERVER_INSTANCE() method
2.) Set options using DVS::IServer::set_options() or DVS::IServer::set_option()
3.) Startup server using DVS::IServer::startup()
4.) If needed see if it's running via DVS::IServer::running()
5.) Shutdown server using DVS::IServer::shutdown()
6.) Destroy instance using DVS::DESTROY_SERVER_INSTANCE()
Definition at line 56 of file dvs_server_interface.h.
Member Function Documentation
◆ create_transport()
|
pure virtual |
Create a transport object to communicate with server, must be destroyed.
- Parameters
-
shared_secret The transport protocol shared secret string used to validate connections. It may be an empty string. If "SERVER_SECURITY_SECRET" is set as a server option shared_secret will be ignored.
- Returns
- ITransport* instance to transport object owned by Server instance
◆ get_timestep_count()
|
pure virtual |
return the current number of pending and complete timesteps in the server
Simple count of the current state of the timesteps in the server
- Parameters
-
num_pending the number of pending timesteps not complete yet num_complete num_complete the number of complete timesteps
- Returns
- dvs_ret DVS_SERVER_NOT_STARTED or DVS_NONE
◆ get_uri()
|
pure virtual |
Get URI of this server.
- Returns
- URI this server was created with
◆ running()
|
pure virtual |
Check to see if the server is running.
Currently this is a dumb check to see if the server was tried to start. If port listening failed this will call will not fail currently.
- Returns
- true if running/started
◆ set_option()
|
pure virtual |
Set a specific option on the server, these are used during startup See See Server Options.
Current available options:
CACHE_URI: This will set the location and type of cache to store data to.
- Parameters
-
key Name of option to set value Value of option
◆ set_options()
|
pure virtual |
Set a collection of options on the server. Overwrites previous options See. See Server Options.
- Parameters
-
options options to set on the server, see DVS::IServer::set_option() for options available
◆ startup()
|
pure virtual |
Start the server.
server_number is used by the DVS server, for each group of servers this number should be unique and monotonically increasing with no gaps (valid: 0, 1, 2 invalid: 0, 2)
local_ranks is used to determine how many clients will be connecting to this server
- Parameters
-
server_number The server number (zero based) for this server, should be unique for each server in this server group local_ranks Number of local ranks this server will handle
- Returns
- dvs_ret DVS_NONE on success, else error code
◆ startup_unthreaded()
|
pure virtual |
Startup a server manually without threads.
This method is for when a user wants to manually run their own server to more tightly control the execution and threading model. This call WILL block until the first timestep is received and will not return unless terminating() has been called from another thread or interrupt.
server_number is used by the DVS server, for each group of servers this number should be unique and monotonically increasing with no gaps (valid: 0, 1, 2 invalid: 0, 2)
local_ranks is used to determine how many clients will be connecting to this server
The normal call chain would be to call startup_unthreaded() and then loop calling update() until some end condition is met. Please see test_dvs_server.cpp for an example.
- Parameters
-
server_number The server number (zero based) for this server, should be unique for each server in this server group local_ranks Number of local ranks this server will handle
- Returns
- dvs_ret DVS_NONE on success, else error code
◆ terminating()
|
pure virtual |
Call to begin terminating the server.
This method begins terminating the server when startup_unthreaded() is invoked. This will cause new updates sending new timesteps, to fail and exit early from any waiting calls on the server.
Important: This call is not needed if using the normal startup method as it will handle this for you.
- Returns
- dvs_ret DVS_NONE on success, DVS_SERVER_FAILED_READER_CREATE if the server wasn't started
◆ update()
|
pure virtual |
Perform a server update.
This method performs a server update. This will: 1.) Perform a complete timestep check and flush complete timesteps to the cache 2.) Perform a check if any new delete_item calls should be processed 3.) Perform a check to see if the dataset definition needs to be updated
The number of pending timesteps from get_timestep_count() will not update unless this is called.
Important: This is not needed to be called if using the normal startup() procedure and should only be used when manually running the server with startup_unthreaded. This must be called periodically for the server to function properly.
- Returns
- dvs_ret DVS_NONE on success
The documentation for this class was generated from the following file:
- D:/ANSYSDev/NoBackup/branches/EnSight-Second-Coming/ensight/user_defined_src/readers/dvs/dvs_server_interface.h