Lobby2Server_PGSQL.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #ifndef __LOBBY_2_SERVER_PGSQL_H
  11. #define __LOBBY_2_SERVER_PGSQL_H
  12. #include "Lobby2Server.h"
  13. class PostgreSQLInterface;
  14. namespace RakNet
  15. {
  16. /// PostgreSQL specific functionality to the lobby server
  17. class RAK_DLL_EXPORT Lobby2Server_PGSQL : public RakNet::Lobby2Server
  18. {
  19. public:
  20. Lobby2Server_PGSQL();
  21. virtual ~Lobby2Server_PGSQL();
  22. STATIC_FACTORY_DECLARATIONS(Lobby2Server_PGSQL)
  23. /// ConnectTo to the database \a numWorkerThreads times using the connection string
  24. /// \param[in] conninfo See the postgre docs
  25. /// \return True on success, false on failure.
  26. virtual bool ConnectToDB(const char *conninfo, int numWorkerThreads);
  27. /// Add input to the worker threads, from a thread already running
  28. virtual void AddInputFromThread(Lobby2Message *msg, unsigned int targetUserId, RakNet::RakString targetUserHandle);
  29. /// Add output from the worker threads, from a thread already running. This is in addition to the current message, so is used for notifications
  30. virtual void AddOutputFromThread(Lobby2Message *msg, unsigned int targetUserId, RakNet::RakString targetUserHandle);
  31. protected:
  32. virtual void AddInputCommand(Lobby2ServerCommand command);
  33. virtual void* PerThreadFactory(void *context);
  34. virtual void PerThreadDestructor(void* factoryResult, void *context);
  35. virtual void ClearConnections(void);
  36. DataStructures::List<PostgreSQLInterface *> connectionPool;
  37. };
  38. }
  39. #endif
粤ICP备19079148号