From 25122b140e8fb6a6b93e1f49f22e8fd522b754bc Mon Sep 17 00:00:00 2001 From: 0del <53461381+0del@users.noreply.github.com> Date: Thu, 4 Apr 2024 00:04:51 +0700 Subject: [PATCH] Rename redisObject to serverObject (#175) Part of #144 Signed-off-by: 0del --- src/evict.c | 2 +- src/module.c | 4 ++-- src/rio.h | 4 ++-- src/server.h | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/evict.c b/src/evict.c index e3b7ebcec..be8cfad75 100644 --- a/src/evict.c +++ b/src/evict.c @@ -69,7 +69,7 @@ static struct evictionPoolEntry *EvictionPoolLRU; /* Return the LRU clock, based on the clock resolution. This is a time * in a reduced-bits format that can be used to set and check the - * object->lru field of redisObject structures. */ + * object->lru field of serverObject structures. */ unsigned int getLRUClock(void) { return (mstime()/LRU_CLOCK_RESOLUTION) & LRU_CLOCK_MAX; } diff --git a/src/module.c b/src/module.c index 1545e6d9c..1a08a9af8 100644 --- a/src/module.c +++ b/src/module.c @@ -430,7 +430,7 @@ typedef struct RedisModuleUser { /* This is a structure used to export some meta-information such as dbid to the module. */ typedef struct RedisModuleKeyOptCtx { - struct redisObject *from_key, *to_key; /* Optional name of key processed, NULL when unknown. + struct serverObject *from_key, *to_key; /* Optional name of key processed, NULL when unknown. In most cases, only 'from_key' is valid, but in callbacks such as `copy2`, both 'from_key' and 'to_key' are valid. */ int from_dbid, to_dbid; /* The dbid of the key being processed, -1 when unknown. @@ -13430,7 +13430,7 @@ const char *RM_GetCurrentCommandName(RedisModuleCtx *ctx) { struct RedisModuleDefragCtx { long long int endtime; unsigned long *cursor; - struct redisObject *key; /* Optional name of key processed, NULL when unknown. */ + struct serverObject *key; /* Optional name of key processed, NULL when unknown. */ int dbid; /* The dbid of the key being processed, -1 when unknown. */ }; diff --git a/src/rio.h b/src/rio.h index 9dd59d32b..2b71c5881 100644 --- a/src/rio.h +++ b/src/rio.h @@ -175,8 +175,8 @@ size_t rioWriteBulkString(rio *r, const char *buf, size_t len); size_t rioWriteBulkLongLong(rio *r, long long l); size_t rioWriteBulkDouble(rio *r, double d); -struct redisObject; -int rioWriteBulkObject(rio *r, struct redisObject *obj); +struct serverObject; +int rioWriteBulkObject(rio *r, struct serverObject *obj); void rioGenericUpdateChecksum(rio *r, const void *buf, size_t len); void rioSetAutoSync(rio *r, off_t bytes); diff --git a/src/server.h b/src/server.h index d4d5495a9..4d7c94bd7 100644 --- a/src/server.h +++ b/src/server.h @@ -81,7 +81,7 @@ typedef long long ustime_t; /* microsecond time type. */ #include "connection.h" /* Connection abstraction */ #define REDISMODULE_CORE 1 -typedef struct redisObject robj; +typedef struct serverObject robj; #include "redismodule.h" /* Redis modules API defines. */ /* Following includes allow test functions to be called from Redis main() */ @@ -750,14 +750,14 @@ typedef void *(*moduleTypeLoadFunc)(struct RedisModuleIO *io, int encver); typedef void (*moduleTypeSaveFunc)(struct RedisModuleIO *io, void *value); typedef int (*moduleTypeAuxLoadFunc)(struct RedisModuleIO *rdb, int encver, int when); typedef void (*moduleTypeAuxSaveFunc)(struct RedisModuleIO *rdb, int when); -typedef void (*moduleTypeRewriteFunc)(struct RedisModuleIO *io, struct redisObject *key, void *value); +typedef void (*moduleTypeRewriteFunc)(struct RedisModuleIO *io, struct serverObject *key, void *value); typedef void (*moduleTypeDigestFunc)(struct RedisModuleDigest *digest, void *value); typedef size_t (*moduleTypeMemUsageFunc)(const void *value); typedef void (*moduleTypeFreeFunc)(void *value); -typedef size_t (*moduleTypeFreeEffortFunc)(struct redisObject *key, const void *value); -typedef void (*moduleTypeUnlinkFunc)(struct redisObject *key, void *value); -typedef void *(*moduleTypeCopyFunc)(struct redisObject *fromkey, struct redisObject *tokey, const void *value); -typedef int (*moduleTypeDefragFunc)(struct RedisModuleDefragCtx *ctx, struct redisObject *key, void **value); +typedef size_t (*moduleTypeFreeEffortFunc)(struct serverObject *key, const void *value); +typedef void (*moduleTypeUnlinkFunc)(struct serverObject *key, void *value); +typedef void *(*moduleTypeCopyFunc)(struct serverObject *fromkey, struct serverObject *tokey, const void *value); +typedef int (*moduleTypeDefragFunc)(struct RedisModuleDefragCtx *ctx, struct serverObject *key, void **value); typedef size_t (*moduleTypeMemUsageFunc2)(struct RedisModuleKeyOptCtx *ctx, const void *value, size_t sample_size); typedef void (*moduleTypeFreeFunc2)(struct RedisModuleKeyOptCtx *ctx, void *value); typedef size_t (*moduleTypeFreeEffortFunc2)(struct RedisModuleKeyOptCtx *ctx, const void *value); @@ -846,7 +846,7 @@ struct RedisModuleIO { moduleType *type; /* Module type doing the operation. */ int error; /* True if error condition happened. */ struct RedisModuleCtx *ctx; /* Optional context, see RM_GetContextFromIO()*/ - struct redisObject *key; /* Optional name of key processed */ + struct serverObject *key; /* Optional name of key processed */ int dbid; /* The dbid of the key being processed, -1 when unknown. */ sds pre_flush_buffer; /* A buffer that should be flushed before next write operation * See rdbSaveSingleModuleAux for more details */ @@ -873,7 +873,7 @@ struct RedisModuleIO { struct RedisModuleDigest { unsigned char o[20]; /* Ordered elements. */ unsigned char x[20]; /* Xored elements. */ - struct redisObject *key; /* Optional name of key processed */ + struct serverObject *key; /* Optional name of key processed */ int dbid; /* The dbid of the key being processed */ }; @@ -909,7 +909,7 @@ struct RedisModuleDigest { #define OBJ_SHARED_REFCOUNT INT_MAX /* Global object never destroyed. */ #define OBJ_STATIC_REFCOUNT (INT_MAX-1) /* Object allocated in the stack. */ #define OBJ_FIRST_SPECIAL_REFCOUNT OBJ_STATIC_REFCOUNT -struct redisObject { +struct serverObject { unsigned type:4; unsigned encoding:4; unsigned lru:LRU_BITS; /* LRU time (relative to global lru_clock) or