73 Commits

Author SHA1 Message Date
antirez
9191287d08 Modules API: Add call to get the blocked client handle from the context.
This is useful in the reply and timeout callback, if the module wants to
do some cleanup of the blocked client handle that may be stored around
in the module-private data structures.
2018-04-13 13:48:11 +02:00
antirez
c8e556d710 Modules API: blocked client disconnection callback. 2018-04-12 13:21:48 +02:00
antirez
338d823975 Modules API: OOM_WARNING flags.
In some modules it may be useful to have an idea about being near to
OOM. Anyway additionally an explicit call to get the fill ratio will be
added in the future.
2018-04-11 16:22:52 +02:00
antirez
7713af1b0c Modules: context flags now include OOM flag.
Plus freeMemoryIfNeeded() refactoring to improve legibility.
Please review this commit for sanity.
2018-04-09 17:44:30 +02:00
antirez
e5b0340ecb Modules: remove trailing empty spaces. 2018-04-09 17:16:55 +02:00
antirez
9f7960ef4d Modules API: experimental APIs version.
This way it is possible to use conditional compilation to be compatible
with a larger amount of Redis versions, however note that this breaks
binary compatibiltiy, so the module must be compiled with the
corresponding redismodule.h file depending on the version of Redis
targeted.
2018-04-09 12:17:19 +02:00
antirez
1331ce96af Modules API: blocked client free callback modified to get a context.
Note that this was an experimental API that can only be enabled with
REIDSMODULE_EXPERIMENTAL_API, so it is subject to change until its
promoted to stable API. Sorry for the breakage, it is trivial to
resolve btw. This change will not be back ported to Redis 4.0.
2018-04-09 11:54:44 +02:00
antirez
5957ec011b Modules API: RM_GetRandomBytes() / GetRandomHexChars(). 2018-04-05 13:24:22 +02:00
antirez
b9f0a4a7d5 Modules Cluster API: GetClusterSize() added. 2018-04-01 16:36:32 +02:00
antirez
778800f2c5 Modules Cluster API: GetMyClusterID() added. 2018-04-01 16:20:57 +02:00
antirez
ba7d6001ba Modules Timer API: fix infinite loop and export API. 2018-03-31 00:44:46 +02:00
antirez
397089524e Modules Timer API: initial implementation. 2018-03-30 20:40:35 +02:00
antirez
b3291b0706 Modules Cluster API: node API exported, example improved. 2018-03-30 17:00:45 +02:00
antirez
611a5097e5 Modules Cluster API: nodes list and info API. 2018-03-30 16:16:47 +02:00
antirez
2ce3d47055 Modules Cluster API: node information struct and flags. 2018-03-30 13:16:55 +02:00
antirez
055ab3623b Modules Cluster API: make node IDs pointers constant. 2018-03-30 13:16:07 +02:00
antirez
9d5a054975 Modules Cluster API: fix new API calls exporting. 2018-03-30 12:49:16 +02:00
antirez
0edbb9221b Modules Cluster API: sending / receiving API first implementation. 2018-03-30 11:06:08 +02:00
Dvir Volk
4496d77fc9 Add REDISMODULE_NOTIFY_STREAM flag to support stream notifications 2018-02-14 21:50:42 +02:00
Dvir Volk
20f414af40 finished implementation of notifications. Tests unfinished 2018-02-14 21:38:58 +02:00
Mark Nunberg
dd5f80e974 redismodule.h: Check ModuleNameBusy before calling it
Older versions might not have this function.
2018-01-23 10:49:18 -05:00
Dvir Volk
7e4794f67c Added RM_UnlinkKey - a low level analog to UNLINK command 2018-01-07 16:41:43 +02:00
Salvatore Sanfilippo
8fa2ab29d8 Merge pull request #4344 from soloestoy/fix-module-name-conflict
Fix module name conflict
2017-11-24 09:37:06 +01:00
zhaozhao.zz
cc7ef78988 Modules: handle the busy module name 2017-09-28 17:38:40 +08:00
Dvir Volk
2f336b5eb7 Renamed GetCtxFlags to GetContextFlags 2017-09-27 11:58:16 +03:00
Dvir Volk
43e4efc52e Added support for module context flags with RM_GetCtxFlags 2017-09-27 11:58:07 +03:00
antirez
7d286826d6 Allow certain modules APIs only defining REDISMODULE_EXPERIMENTAL_API.
Those calls may be subject to changes in the future, so the user should
acknowledge it is using non stable API.
2017-07-14 12:07:52 +02:00
antirez
45c2679529 Modules: DEBUG DIGEST interface. 2017-07-06 11:04:46 +02:00
antirez
d8b3f3f854 Modules TSC: Export symbols of the new API. 2017-05-02 15:19:28 +02:00
antirez
ab7d6831a3 Use const in modules types mem_usage method.
As suggested by @itamarhaber.
2017-01-12 12:47:46 +01:00
Yossi Gottlieb
1f1955766d Fix typo in RedisModuleTypeMethods declaration. 2016-11-30 22:05:59 +02:00
antirez
4d71791b17 Modules: change type registration API to use a struct of methods. 2016-11-30 11:14:01 +01:00
antirez
68269e1a6a Modules: AbortBlock() API implemented. 2016-10-13 16:57:40 +02:00
antirez
7bc2b181c8 Modules: RM_Milliseconds() API added. 2016-10-07 16:34:19 +02:00
antirez
59949257af Modules: blocking commands WIP: API exported, a first example. 2016-10-07 13:48:14 +02:00
antirez
4eec3f7d02 Modules: introduce warning suppression macro for unused args. 2016-10-07 13:10:31 +02:00
antirez
3398c93043 Fix typos in GetContextFromIO API declaration. 2016-10-06 18:26:04 +02:00
antirez
56f2406e09 Module: Ability to get context from IO context.
It was noted by @dvirsky that it is not possible to use string functions
when writing the AOF file. This sometimes is critical since the command
rewriting may need to be built in the context of the AOF callback, and
without access to the context, and the limited types that the AOF
production functions will accept, this can be an issue.

Moreover there are other needs that we can't anticipate regarding the
ability to use Redis Modules APIs using the context in order to build
representations to emit AOF / RDB.

Because of this a new API was added that allows the user to get a
temporary context from the IO context. The context is auto released
if obtained when the RDB / AOF callback returns.

Calling multiple time the function to get the context, always returns
the same one, since it is invalid to have more than a single context.
2016-10-06 17:09:26 +02:00
antirez
adcafbd283 Modules: API to save/load single precision floating point numbers.
When double precision is not needed, to take 2x space in the
serialization is not good.
2016-10-03 00:08:35 +02:00
antirez
8c561f8430 Modules: API to log from module I/O callbacks. 2016-10-02 16:51:37 +02:00
Dvir Volk
b8a375fe59 added RM_CreateStringPrintf 2016-09-21 12:30:38 +03:00
antirez
e3cb70f2e4 Modules: initial draft for a testing module. 2016-08-03 10:23:03 +02:00
antirez
f7a8b65f3d Modules: StringAppendBuffer() and ability to retain strings.
RedisModule_StringRetain() allows, when automatic memory management is
on, to keep string objects living after the callback returns. Can also
be used in order to use Redis reference counting of objects inside
modules.

The reason why this is useful is that sometimes when implementing new
data types we want to reference RedisModuleString objects inside the
module private data structures, so those string objects must be valid
after the callback returns even if not referenced inside the Redis key
space.
2016-08-02 15:29:04 +02:00
Yossi Gottlieb
126de75d90 Fix RedisModule_Calloc() definition typo. 2016-06-23 22:30:32 +03:00
Salvatore Sanfilippo
8e767386b7 Merge pull request #3335 from dvirsky/rm_calloc
added RM_Calloc implementation
2016-06-23 16:19:14 +02:00
Salvatore Sanfilippo
cea51549b8 Merge pull request #3336 from yossigo/create_string_from_string
Add RedisModule_CreateStringFromString().
2016-06-23 16:16:28 +02:00
Salvatore Sanfilippo
408b1cbd7e Merge pull request #3330 from yossigo/fix_const
Use const in Redis Module API where possible.
2016-06-23 12:29:52 +02:00
antirez
d2ace2c15a Modules: changes to logging function.
This commit changes what provided by PR #3315 (merged) in order to
let the user specify the log level as a string.

The define could be also used, but when this happens, they must be
decoupled from the defines in the Redis core, like in the other part of
the Redis modules implementations, so that a switch statement (or a
function) remaps between the two, otherwise we are no longer free to
change the internal Redis defines.
2016-06-23 12:11:30 +02:00
Yossi Gottlieb
ee0ea33013 Add RedisModule_Log() logging API function. 2016-06-23 12:01:44 +02:00
Yossi Gottlieb
c7ec9f280f Add RedisModule_CreateStringFromString(). 2016-06-22 21:02:40 +03:00