redis.hpp 8.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2015 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 ECL_REDIS_SYNC_INCL
  14. #define ECL_REDIS_SYNC_INCL
  15. #ifdef _WIN32
  16. #define ECL_REDIS_CALL _cdecl
  17. #ifdef ECL_REDIS_EXPORTS
  18. #define ECL_REDIS_API __declspec(dllexport)
  19. #else
  20. #define ECL_REDIS_API __declspec(dllimport)
  21. #endif
  22. #else
  23. #define ECL_REDIS_CALL
  24. #define ECL_REDIS_API
  25. #endif
  26. #include "hqlplugins.hpp"
  27. #include "eclhelper.hpp"
  28. extern "C"
  29. {
  30. ECL_REDIS_API bool getECLPluginDefinition(ECLPluginDefinitionBlock *pb);
  31. ECL_REDIS_API void setPluginContext(IPluginContext * _ctx);
  32. }
  33. extern "C++"
  34. {
  35. namespace RedisPlugin {
  36. //--------------------------SET----------------------------------------
  37. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetBool (ICodeContext * _ctx, const char * key, bool value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  38. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetInt (ICodeContext * _ctx, const char * key, signed __int64 value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  39. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetUInt (ICodeContext * _ctx, const char * key, unsigned __int64 value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  40. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetReal (ICodeContext * _ctx, const char * key, double value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  41. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetUtf8 (ICodeContext * _ctx, const char * key, size32_t valueLength, const char * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  42. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetStr (ICodeContext * _ctx, const char * key, size32_t valueLength, const char * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  43. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetUChar(ICodeContext * _ctx, const char * key, size32_t valueLength, const UChar * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  44. ECL_REDIS_API void ECL_REDIS_CALL SyncRSetData (ICodeContext * _ctx, const char * key, size32_t valueLength, const void * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  45. //--------------------------GET----------------------------------------
  46. ECL_REDIS_API bool ECL_REDIS_CALL SyncRGetBool (ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  47. ECL_REDIS_API signed __int64 ECL_REDIS_CALL SyncRGetInt8 (ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  48. ECL_REDIS_API unsigned __int64 ECL_REDIS_CALL SyncRGetUint8 (ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  49. ECL_REDIS_API double ECL_REDIS_CALL SyncRGetDouble(ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  50. ECL_REDIS_API void ECL_REDIS_CALL SyncRGetUtf8 (ICodeContext * _ctx, size32_t & returnLength, char * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  51. ECL_REDIS_API void ECL_REDIS_CALL SyncRGetStr (ICodeContext * _ctx, size32_t & returnLength, char * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  52. ECL_REDIS_API void ECL_REDIS_CALL SyncRGetUChar (ICodeContext * _ctx, size32_t & returnLength, UChar * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  53. ECL_REDIS_API void ECL_REDIS_CALL SyncRGetData (ICodeContext * _ctx,size32_t & returnLength, void * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  54. //--------------------------------AUXILLARIES---------------------------
  55. ECL_REDIS_API bool ECL_REDIS_CALL RExist (ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  56. ECL_REDIS_API void ECL_REDIS_CALL RClear (ICodeContext * _ctx, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  57. ECL_REDIS_API void ECL_REDIS_CALL RDel (ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  58. ECL_REDIS_API void ECL_REDIS_CALL RPersist(ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  59. ECL_REDIS_API void ECL_REDIS_CALL RExpire (ICodeContext * _ctx, const char * key, const char * options, unsigned expire, unsigned __int64 database, const char * pswd, unsigned timeout);
  60. ECL_REDIS_API unsigned __int64 ECL_REDIS_CALL RDBSize (ICodeContext * _ctx, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout);
  61. //--------------------------SET----------------------------------------
  62. ECL_REDIS_API void ECL_REDIS_CALL SyncLockRSetUtf8 (ICodeContext * _ctx, size32_t & returnLength, char * & returnValue, const char * key, size32_t valueLength, const char * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  63. ECL_REDIS_API void ECL_REDIS_CALL SyncLockRSetStr (ICodeContext * _ctx, size32_t & returnLength, char * & returnValue, const char * key, size32_t valueLength, const char * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  64. ECL_REDIS_API void ECL_REDIS_CALL SyncLockRSetUChar(ICodeContext * _ctx, size32_t & returnLength, UChar * & returnValue, const char * key, size32_t valueLength, const UChar * value, const char * options, unsigned __int64 database, unsigned expire, const char * pswd, unsigned timeout);
  65. //--------------------------GET----------------------------------------
  66. ECL_REDIS_API void ECL_REDIS_CALL SyncLockRGetUtf8 (ICodeContext * _ctx, size32_t & returnLength, char * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout, unsigned expire);
  67. ECL_REDIS_API void ECL_REDIS_CALL SyncLockRGetStr (ICodeContext * _ctx, size32_t & returnLength, char * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout, unsigned expire);
  68. ECL_REDIS_API void ECL_REDIS_CALL SyncLockRGetUChar (ICodeContext * _ctx, size32_t & returnLength, UChar * & returnValue, const char * key, const char * options, unsigned __int64 database, const char * pswd, unsigned timeout, unsigned expire);
  69. ECL_REDIS_API bool ECL_REDIS_CALL SyncLockRMissThenLock(ICodeContext * _ctx, const char * key, const char * options, unsigned __int64 database, const char * password, unsigned __int64 timeout);
  70. }
  71. }
  72. #endif