#include <LightweightDatabaseServer.h>
Public Member Functions | |
DataStructures::Table * | GetTable (const char *tableName) |
DataStructures::Table * | AddTable (const char *tableName, bool allowRemoteQuery, bool allowRemoteUpdate, bool allowRemoteRemove, const char *queryPassword, const char *updatePassword, const char *removePassword, bool oneRowPerSystemAddress, bool onlyUpdateOwnRows, bool removeRowOnPingFailure, bool removeRowOnDisconnect, bool autogenerateRowIDs) |
bool | RemoveTable (const char *tableName) |
void | Clear (void) |
Clears all memory. | |
DataStructures::Page< unsigned, DataStructures::Table::Row *, _TABLE_BPLUS_TREE_ORDER > * | GetTableRows (const char *tableName) |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
DataStructures::Table* LightweightDatabaseServer::AddTable | ( | const char * | tableName, | |
bool | allowRemoteQuery, | |||
bool | allowRemoteUpdate, | |||
bool | allowRemoteRemove, | |||
const char * | queryPassword, | |||
const char * | updatePassword, | |||
const char * | removePassword, | |||
bool | oneRowPerSystemAddress, | |||
bool | onlyUpdateOwnRows, | |||
bool | removeRowOnPingFailure, | |||
bool | removeRowOnDisconnect, | |||
bool | autogenerateRowIDs | |||
) |
Adds a new table It is valid to read and write to the returned pointer.
[in] | tableName | Name of the new table to create. Remote systems will refer to this table by this name. |
[in] | allowRemoteQuery | true to allow remote systems to query the table. false to not allow this. |
[in] | allowRemoteUpdate | true to allow remote systems to update rows in the table. false to not allow this. |
[in] | allowRemoteRemove | true to allow remote systems to remove rows from the table. false to not allow this. |
[in] | queryPassword | The password required to query the table. Pass an empty string for no password. |
[in] | updatePassword | The password required to update rows in the table. Pass an empty string for no password. |
[in] | removePassword | The password required to remove rows from the table. Pass an empty string for no password. |
[in] | oneRowPerSystemAddress | Only used if allowRemoteUpdate==true. This limits remote systems to one row. |
[in] | onlyUpdateOwnRows | Only used if allowRemoteUpdate==true. This limits remote systems to only updating rows they created. |
[in] | removeRowOnPingFailure | Only used if allowRemoteUpdate==true and removeRowOnDisconnect==false. If true, this will periodically ping disconnected systems and remove rows created by that system if that system does not respond to pings. |
[in] | removeRowOnDisconnect | Only used if allowRemoteUpdate==true. This removes rows created by a system when that system disconnects. |
[in] | autogenerateRowIDs | true to automatically generate row IDs. Rows are stored in order by row ID. If false, the clients must specify a unique row ID when adding rows. If they specify a row that already exists the addition is ignored. |
DataStructures::Table* LightweightDatabaseServer::GetTable | ( | const char * | tableName | ) |
Returns a table by name. It is valid to read and write to the returned pointer.
[in] | tableName | The name of the table that was passed to AddTable |
DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER>* LightweightDatabaseServer::GetTableRows | ( | const char * | tableName | ) |
Returns a linked list of ordered lists containing the rows of a table, by name. The returned structure is internal to the BPlus tree. See DS_BPlusTree This is a convenience accessor, as you can also get this from the table returned from GetTable()
[in] | tableName | The name of the table that was passed to AddTable |
virtual void LightweightDatabaseServer::OnClosedConnection | ( | SystemAddress | systemAddress, | |
RakNetGUID | rakNetGUID, | |||
PI2_LostConnectionReason | lostConnectionReason | |||
) | [virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
[in] | systemAddress | The system whose connection was closed |
[in] | rakNetGuid | The guid of the specified system |
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection |
Reimplemented from PluginInterface2.
virtual PluginReceiveResult LightweightDatabaseServer::OnReceive | ( | Packet * | packet | ) | [virtual] |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from PluginInterface2.
bool LightweightDatabaseServer::RemoveTable | ( | const char * | tableName | ) |
Removes a table by name.
[in] | tableName | The name of the table that was passed to AddTable |