diff options
author | dormando <dormando@rydia.net> | 2023-01-09 18:08:26 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-01-11 13:24:22 -0800 |
commit | fccf7b9efdfb0deb11f111496ce53c5892647dab (patch) | |
tree | a3c2f6bafee2d80a609806627bd3922e0aa6cd08 /thread.c | |
parent | 8bb9d9a3e5ca93c38db97181d4c15b03d48a644d (diff) | |
download | memcached-fccf7b9efdfb0deb11f111496ce53c5892647dab.tar.gz |
core: remove *conn object from cache commands
We want to start using cache commands in contexts without a client
connection, but the client object has always been passed to all
functions.
In most cases we only need the worker thread (LIBEVENT_THREAD *t), so
this change adjusts the arguments passed in.
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -809,7 +809,7 @@ void sidethread_conn_close(conn *c) { /* * Allocates a new item. */ -item *item_alloc(char *key, size_t nkey, int flags, rel_time_t exptime, int nbytes) { +item *item_alloc(const char *key, size_t nkey, int flags, rel_time_t exptime, int nbytes) { item *it; /* do_item_alloc handles its own locks */ it = do_item_alloc(key, nkey, flags, exptime, nbytes); @@ -820,12 +820,12 @@ item *item_alloc(char *key, size_t nkey, int flags, rel_time_t exptime, int nbyt * Returns an item if it hasn't been marked as expired, * lazy-expiring as needed. */ -item *item_get(const char *key, const size_t nkey, conn *c, const bool do_update) { +item *item_get(const char *key, const size_t nkey, LIBEVENT_THREAD *t, const bool do_update) { item *it; uint32_t hv; hv = hash(key, nkey); item_lock(hv); - it = do_item_get(key, nkey, hv, c, do_update); + it = do_item_get(key, nkey, hv, t, do_update); item_unlock(hv); return it; } @@ -833,20 +833,20 @@ item *item_get(const char *key, const size_t nkey, conn *c, const bool do_update // returns an item with the item lock held. // lock will still be held even if return is NULL, allowing caller to replace // an item atomically if desired. -item *item_get_locked(const char *key, const size_t nkey, conn *c, const bool do_update, uint32_t *hv) { +item *item_get_locked(const char *key, const size_t nkey, LIBEVENT_THREAD *t, const bool do_update, uint32_t *hv) { item *it; *hv = hash(key, nkey); item_lock(*hv); - it = do_item_get(key, nkey, *hv, c, do_update); + it = do_item_get(key, nkey, *hv, t, do_update); return it; } -item *item_touch(const char *key, size_t nkey, uint32_t exptime, conn *c) { +item *item_touch(const char *key, size_t nkey, uint32_t exptime, LIBEVENT_THREAD *t) { item *it; uint32_t hv; hv = hash(key, nkey); item_lock(hv); - it = do_item_touch(key, nkey, exptime, hv, c); + it = do_item_touch(key, nkey, exptime, hv, t); item_unlock(hv); return it; } @@ -901,7 +901,7 @@ void item_unlink(item *item) { /* * Does arithmetic on a numeric item value. */ -enum delta_result_type add_delta(conn *c, const char *key, +enum delta_result_type add_delta(LIBEVENT_THREAD *t, const char *key, const size_t nkey, bool incr, const int64_t delta, char *buf, uint64_t *cas) { @@ -910,7 +910,7 @@ enum delta_result_type add_delta(conn *c, const char *key, hv = hash(key, nkey); item_lock(hv); - ret = do_add_delta(c, key, nkey, incr, delta, buf, cas, hv, NULL); + ret = do_add_delta(t, key, nkey, incr, delta, buf, cas, hv, NULL); item_unlock(hv); return ret; } @@ -918,13 +918,13 @@ enum delta_result_type add_delta(conn *c, const char *key, /* * Stores an item in the cache (high level, obeys set/add/replace semantics) */ -enum store_item_type store_item(item *item, int comm, conn* c) { +enum store_item_type store_item(item *item, int comm, LIBEVENT_THREAD *t, uint64_t *cas, bool cas_stale) { enum store_item_type ret; uint32_t hv; hv = hash(ITEM_key(item), item->nkey); item_lock(hv); - ret = do_store_item(item, comm, c, hv); + ret = do_store_item(item, comm, t, hv, cas, cas_stale); item_unlock(hv); return ret; } |