Last active
May 17, 2016 12:01
-
-
Save dvirsky/1ae363ca8f46ed34ac91afd583bb7775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A serializer prototype - you serialize by calling Write N times. | |
// the key type is determined on registration so not needed here | |
// the list size will be determined by redis when you exit, based on the number of times you called write() | |
int (*Serialize)(RedisModuleCtx *ctx, RedisModuleObjectWriter *out, RedisModuleKey *k) | |
// you deserialize by calling Read and reading one object at a time. | |
// numElements is passed so the user can preallocate stuff in advance | |
int (*Deserialize)(RedisModuleCtx *ctx, RedisModuleObjectReader *in, RedisModuleString *keyName, size_t numElements) | |
// reader/writer methods - each one reads or writes a complete object | |
int ObjectWriter_Write(RedisModuleObjectWriter *w, char *data, size_t len); | |
int ObjectReader_Read(RedisModuleObjectReader *r, char **data, size_t &len); | |
// we can add higher level write/read utils, e.g.: | |
int ObjectWriter_WriteInt64(RedisModuleObjectWriter, int_64_t i); | |
int ObjectWriter_WriteVarint(RedisModuleObjectWriter, int_64_t i); | |
.. etc etc - not sure if needed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment