Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebranding of code in libvalkeycluster #15

Merged
merged 7 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions libvalkeycluster/adapters/ae.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __HIREDIS_CLUSTER_AE_H__
#define __HIREDIS_CLUSTER_AE_H__
#ifndef __VALKEYCLUSTER_AE_H__
bjosv marked this conversation as resolved.
Show resolved Hide resolved
#define __VALKEYCLUSTER_AE_H__

#include "../hircluster.h"
#include <hiredis/adapters/ae.h>
#include "../valkeycluster.h"
#include <valkey/adapters/ae.h>

static int redisAeAttach_link(redisAsyncContext *ac, void *base) {
return redisAeAttach((aeEventLoop *)base, ac);
static int valkeyAeAttach_link(valkeyAsyncContext *ac, void *base) {
return valkeyAeAttach((aeEventLoop *)base, ac);
}

static int redisClusterAeAttach(aeEventLoop *loop,
redisClusterAsyncContext *acc) {
static int valkeyClusterAeAttach(aeEventLoop *loop,
valkeyClusterAsyncContext *acc) {

if (acc == NULL || loop == NULL) {
return REDIS_ERR;
return VALKEY_ERR;
}

acc->adapter = loop;
acc->attach_fn = redisAeAttach_link;
acc->attach_fn = valkeyAeAttach_link;

return REDIS_OK;
return VALKEY_OK;
}

#endif
32 changes: 16 additions & 16 deletions libvalkeycluster/adapters/glib.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __HIREDIS_CLUSTER_GLIB_H__
#define __HIREDIS_CLUSTER_GLIB_H__
#ifndef __VALKEYCLUSTER_GLIB_H__
#define __VALKEYCLUSTER_GLIB_H__

#include "../hircluster.h"
#include <hiredis/adapters/glib.h>
#include "../valkeycluster.h"
#include <valkey/adapters/glib.h>

typedef struct redisClusterGlibAdapter {
typedef struct valkeyClusterGlibAdapter {
GMainContext *context;
} redisClusterGlibAdapter;
} valkeyClusterGlibAdapter;

static int redisGlibAttach_link(redisAsyncContext *ac, void *adapter) {
GMainContext *context = ((redisClusterGlibAdapter *)adapter)->context;
if (g_source_attach(redis_source_new(ac), context) > 0) {
return REDIS_OK;
static int valkeyGlibAttach_link(valkeyAsyncContext *ac, void *adapter) {
GMainContext *context = ((valkeyClusterGlibAdapter *)adapter)->context;
if (g_source_attach(valkey_source_new(ac), context) > 0) {
return VALKEY_OK;
}
return REDIS_ERR;
return VALKEY_ERR;
}

static int redisClusterGlibAttach(redisClusterAsyncContext *acc,
redisClusterGlibAdapter *adapter) {
static int valkeyClusterGlibAttach(valkeyClusterAsyncContext *acc,
valkeyClusterGlibAdapter *adapter) {
if (acc == NULL || adapter == NULL) {
return REDIS_ERR;
return VALKEY_ERR;
}

acc->adapter = adapter;
acc->attach_fn = redisGlibAttach_link;
acc->attach_fn = valkeyGlibAttach_link;

return REDIS_OK;
return VALKEY_OK;
}

#endif
22 changes: 11 additions & 11 deletions libvalkeycluster/adapters/libev.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __HIREDIS_CLUSTER_LIBEV_H__
#define __HIREDIS_CLUSTER_LIBEV_H__
#ifndef __LIBVALKEYCLUSTER_LIBEV_H__
#define __LIBVALKEYCLUSTER_LIBEV_H__

#include "../hircluster.h"
#include <hiredis/adapters/libev.h>
#include "../valkeycluster.h"
#include <valkey/adapters/libev.h>

static int redisLibevAttach_link(redisAsyncContext *ac, void *loop) {
return redisLibevAttach((struct ev_loop *)loop, ac);
static int valkeyLibevAttach_link(valkeyAsyncContext *ac, void *loop) {
return valkeyLibevAttach((struct ev_loop *)loop, ac);
}

static int redisClusterLibevAttach(redisClusterAsyncContext *acc,
struct ev_loop *loop) {
static int valkeyClusterLibevAttach(valkeyClusterAsyncContext *acc,
struct ev_loop *loop) {
if (loop == NULL || acc == NULL) {
return REDIS_ERR;
return VALKEY_ERR;
}

acc->adapter = loop;
acc->attach_fn = redisLibevAttach_link;
acc->attach_fn = valkeyLibevAttach_link;

return REDIS_OK;
return VALKEY_OK;
}

#endif
22 changes: 11 additions & 11 deletions libvalkeycluster/adapters/libevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __HIREDIS_CLUSTER_LIBEVENT_H__
#define __HIREDIS_CLUSTER_LIBEVENT_H__
#ifndef __LIBVALKEYCLUSTER_LIBEVENT_H__
#define __LIBVALKEYCLUSTER_LIBEVENT_H__

#include "../hircluster.h"
#include <hiredis/adapters/libevent.h>
#include "../valkeycluster.h"
#include <valkey/adapters/libevent.h>

static int redisLibeventAttach_link(redisAsyncContext *ac, void *base) {
return redisLibeventAttach(ac, (struct event_base *)base);
static int valkeyLibeventAttach_link(valkeyAsyncContext *ac, void *base) {
return valkeyLibeventAttach(ac, (struct event_base *)base);
}

static int redisClusterLibeventAttach(redisClusterAsyncContext *acc,
struct event_base *base) {
static int valkeyClusterLibeventAttach(valkeyClusterAsyncContext *acc,
struct event_base *base) {

if (acc == NULL || base == NULL) {
return REDIS_ERR;
return VALKEY_ERR;
}

acc->adapter = base;
acc->attach_fn = redisLibeventAttach_link;
acc->attach_fn = valkeyLibeventAttach_link;

return REDIS_OK;
return VALKEY_OK;
}

#endif
22 changes: 11 additions & 11 deletions libvalkeycluster/adapters/libuv.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __HIREDIS_CLUSTER_LIBUV_H__
#define __HIREDIS_CLUSTER_LIBUV_H__
#ifndef __LIBVALKEYCLUSTER_LIBUV_H__
#define __LIBVALKEYCLUSTER_LIBUV_H__

#include "../hircluster.h"
#include <hiredis/adapters/libuv.h>
#include "../valkeycluster.h"
#include <valkey/adapters/libuv.h>

static int redisLibuvAttach_link(redisAsyncContext *ac, void *loop) {
return redisLibuvAttach(ac, (uv_loop_t *)loop);
static int valkeyLibuvAttach_link(valkeyAsyncContext *ac, void *loop) {
return valkeyLibuvAttach(ac, (uv_loop_t *)loop);
}

static int redisClusterLibuvAttach(redisClusterAsyncContext *acc,
uv_loop_t *loop) {
static int valkeyClusterLibuvAttach(valkeyClusterAsyncContext *acc,
uv_loop_t *loop) {

if (acc == NULL || loop == NULL) {
return REDIS_ERR;
return VALKEY_ERR;
}

acc->adapter = loop;
acc->attach_fn = redisLibuvAttach_link;
acc->attach_fn = valkeyLibuvAttach_link;

return REDIS_OK;
return VALKEY_OK;
}

#endif
22 changes: 11 additions & 11 deletions libvalkeycluster/adlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <hiredis/alloc.h>
#include <stdlib.h>
#include <valkey/alloc.h>
bjosv marked this conversation as resolved.
Show resolved Hide resolved

#include "adlist.h"
#include "hiutil.h"
#include "vkutil.h"

/* Create a new list. The created list can be freed with
* AlFreeList(), but private value of every node need to be freed
Expand All @@ -41,7 +41,7 @@
hilist *listCreate(void) {
struct hilist *list;

if ((list = hi_malloc(sizeof(*list))) == NULL)
if ((list = vk_malloc(sizeof(*list))) == NULL)
bjosv marked this conversation as resolved.
Show resolved Hide resolved
return NULL;
list->head = list->tail = NULL;
list->len = 0;
Expand All @@ -64,10 +64,10 @@ void listRelease(hilist *list) {
next = current->next;
if (list->free)
list->free(current->value);
hi_free(current);
vk_free(current);
current = next;
}
hi_free(list);
vk_free(list);
}

/* Add a new node to the list, to head, containing the specified 'value'
Expand All @@ -79,7 +79,7 @@ void listRelease(hilist *list) {
hilist *listAddNodeHead(hilist *list, void *value) {
listNode *node;

if ((node = hi_malloc(sizeof(*node))) == NULL)
if ((node = vk_malloc(sizeof(*node))) == NULL)
return NULL;
node->value = value;
if (list->len == 0) {
Expand All @@ -104,7 +104,7 @@ hilist *listAddNodeHead(hilist *list, void *value) {
hilist *listAddNodeTail(hilist *list, void *value) {
listNode *node;

if ((node = hi_malloc(sizeof(*node))) == NULL)
if ((node = vk_malloc(sizeof(*node))) == NULL)
return NULL;
node->value = value;
if (list->len == 0) {
Expand All @@ -124,7 +124,7 @@ hilist *listInsertNode(hilist *list, listNode *old_node, void *value,
int after) {
listNode *node;

if ((node = hi_malloc(sizeof(*node))) == NULL)
if ((node = vk_malloc(sizeof(*node))) == NULL)
return NULL;
node->value = value;
if (after) {
Expand Down Expand Up @@ -165,7 +165,7 @@ void listDelNode(hilist *list, listNode *node) {
list->tail = node->prev;
if (list->free)
list->free(node->value);
hi_free(node);
vk_free(node);
list->len--;
}

Expand All @@ -176,7 +176,7 @@ void listDelNode(hilist *list, listNode *node) {
listIter *listGetIterator(hilist *list, int direction) {
listIter *iter;

if ((iter = hi_malloc(sizeof(*iter))) == NULL)
if ((iter = vk_malloc(sizeof(*iter))) == NULL)
return NULL;
if (direction == AL_START_HEAD)
iter->next = list->head;
Expand All @@ -187,7 +187,7 @@ listIter *listGetIterator(hilist *list, int direction) {
}

/* Release the iterator memory */
void listReleaseIterator(listIter *iter) { hi_free(iter); }
void listReleaseIterator(listIter *iter) { vk_free(iter); }

/* Create an iterator in the list private iterator structure */
void listRewind(hilist *list, listIter *li) {
Expand Down
Loading
Loading