dafsserver.hpp 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef SOCKFILE_HPP
  14. #define SOCKFILE_HPP
  15. #include "jsocket.hpp"
  16. #ifdef DAFSSERVER_EXPORTS
  17. #define DAFSSERVER_API DECL_EXPORT
  18. #else
  19. #define DAFSSERVER_API DECL_IMPORT
  20. #endif
  21. #define DAFILESRV_METAINFOVERSION 2
  22. #define DAFILESRV_STREAMREAD_MINVERSION 22
  23. #define DAFILESRV_STREAMGENERAL_MINVERSION 25
  24. // RemoteFileServer throttling defaults
  25. #define DEFAULT_THREADLIMIT 100
  26. #define DEFAULT_THREADLIMITDELAYMS (60*1000)
  27. #define DEFAULT_ASYNCCOPYMAX 10
  28. #define DEFAULT_STDCMD_PARALLELREQUESTLIMIT 80
  29. #define DEFAULT_STDCMD_THROTTLEDELAYMS 1000
  30. #define DEFAULT_STDCMD_THROTTLECPULIMIT 85
  31. #define DEFAULT_STDCMD_THROTTLEQUEUELIMIT 1000
  32. #define DEFAULT_SLOWCMD_PARALLELREQUESTLIMIT 20
  33. #define DEFAULT_SLOWCMD_THROTTLEDELAYMS 5000
  34. #define DEFAULT_SLOWCMD_THROTTLECPULIMIT 75
  35. #define DEFAULT_SLOWCMD_THROTTLEQUEUELIMIT 1000
  36. enum RowServiceCfg
  37. {
  38. rs_off, // No dedicated row service, allows row service commands on std. dafilesrv port.
  39. rs_on, // Dedicated row service on own port accepting authorized signed connections only. Row service commands on std. dafilersv port will be refused.
  40. rs_both, // Dedicated row service on own port accepting authorized signed connections only. Still accepts unsigned connection on std. dafilesrv port
  41. rs_onssl, // Same as rs_on, but SSL
  42. rs_bothssl // Same as rs_only, but SSL
  43. };
  44. interface IRemoteFileServer : extends IInterface
  45. {
  46. virtual void run(DAFSConnectCfg connectMethod, const SocketEndpoint &listenep, unsigned sslPort=0, const SocketEndpoint *rowServiceEp=nullptr, bool rowServiceSSL=false, bool rowServiceOnStdPort=true) = 0;
  47. virtual void run(DAFSConnectCfg _connectMethod, ISocket *listenSocket, ISocket *secureSocket, ISocket *rowServiceSocket) = 0;
  48. virtual void stop() = 0;
  49. virtual unsigned idleTime() = 0; // in ms
  50. virtual void setThrottle(ThrottleClass throttleClass, unsigned limit, unsigned delayMs=DEFAULT_STDCMD_THROTTLEDELAYMS, unsigned cpuThreshold=DEFAULT_STDCMD_THROTTLECPULIMIT, unsigned queueLimit=DEFAULT_STDCMD_THROTTLEQUEUELIMIT) = 0;
  51. virtual StringBuffer &getStats(StringBuffer &stats, bool reset) = 0;
  52. };
  53. interface IRemoteRowServer : extends IInterface
  54. {
  55. virtual void run(unsigned port=0) = 0;
  56. virtual void stop() = 0;
  57. virtual unsigned idleTime() = 0; // in ms
  58. virtual void setThrottle(ThrottleClass throttleClass, unsigned limit, unsigned delayMs=DEFAULT_STDCMD_THROTTLEDELAYMS, unsigned cpuThreshold=DEFAULT_STDCMD_THROTTLECPULIMIT, unsigned queueLimit=DEFAULT_STDCMD_THROTTLEQUEUELIMIT) = 0;
  59. virtual StringBuffer &getStats(StringBuffer &stats, bool reset) = 0;
  60. };
  61. interface IKeyManager;
  62. interface IDelayedFile;
  63. interface IDaFsConnection;
  64. extern DAFSSERVER_API const char *remoteServerVersionString();
  65. extern DAFSSERVER_API IRemoteFileServer * createRemoteFileServer(unsigned maxThreads=DEFAULT_THREADLIMIT, unsigned maxThreadsDelayMs=DEFAULT_THREADLIMITDELAYMS, unsigned maxAsyncCopy=DEFAULT_ASYNCCOPYMAX, IPropertyTree *keyPairInfo=nullptr);
  66. extern DAFSSERVER_API int setDaliServerTrace(byte flags);
  67. extern DAFSSERVER_API bool enableDaliServerAuthentication(bool on);
  68. #endif