1,073 matches across 25 files for func main
snippet_mode: auto · sorted by relevance
memcached.c C 77 matches · showing 5 view file →
118static conn *listen_conn = NULL;
119static int max_fds;
120static struct event_base *main_base;
121
122enum transmit_result {
· · ·
123 TRANSMIT_COMPLETE, /** All done writing. */
124 TRANSMIT_INCOMPLETE, /** More data remaining to write. */
125 TRANSMIT_SOFT_ERROR, /** Can't write any more right now. */
126 TRANSMIT_HARD_ERROR /** Can't write (c->state is set to conn_closing) */
· · ·
151 */
152static volatile bool allow_new_conns = true;
153static int stop_main_loop = NOT_STOP;
154static struct event maxconnsevent;
155static void maxconns_handler(const evutil_socket_t fd, const short which, void *arg) {
· · ·
159 /* reschedule in 10ms if we need to keep polling */
160 evtimer_set(&maxconnsevent, maxconns_handler, 0);
161 event_base_set(main_base, &maxconnsevent);
162 evtimer_add(&maxconnsevent, &t);
163 } else {
· · ·
246 settings.lru_crawler_sleep = 100;
247 settings.lru_crawler_tocrawl = 0;
248 settings.lru_maintainer_thread = false;
249 settings.lru_segmented = true;
250 settings.hot_lru_pct = 20;
+ 72 more matches in this file
proxy_network.c C 52 matches · showing 5 view file →
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2// Functions related to the backend handler thread.
3
4#include "proxy.h"
· · ·
54static void _cleanup_backend(mcp_backend_t *be);
55static void _reset_bad_backend(struct mcp_backendconn_s *be, enum proxy_be_failures err);
56static void _set_main_event(struct mcp_backendconn_s *be, struct event_base *base, int flags, struct timeval *t, event_callback_fn callback);
57static void _stop_main_event(struct mcp_backendconn_s *be);
58static void _start_write_event(struct mcp_backendconn_s *be);
· · ·
57static void _stop_main_event(struct mcp_backendconn_s *be);
58static void _start_write_event(struct mcp_backendconn_s *be);
59static void _stop_write_event(struct mcp_backendconn_s *be);
· · ·
89 // We were connecting, now ensure we're properly connected.
90 if (mcmc_check_nonblock_connect(be->client, &err) != MCMC_OK) {
91 P_DEBUG("%s: backend failed to connect (%s:%s)\n", __func__, be->be_parent->name, be->be_parent->port);
92 // kick the bad backend, clear the queue, retry later.
93 // FIXME (v2): if a connect fails, anything currently in the queue
· · ·
96 return -1;
97 }
98 P_DEBUG("%s: backend connected [fd: %d] (%s:%s)\n", __func__, mcmc_fd(be->client), be->be_parent->name, be->be_parent->port);
99 be->connecting = false;
100 be->state = mcp_backend_read;
+ 47 more matches in this file
proto_proxy.c C 59 matches · showing 5 view file →
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Functions for handling the proxy layer. wraps text protocols
4 *
5 * NOTE: many lua functions generate pointers via "lua_newuserdatauv" or
· · ·
5 * NOTE: many lua functions generate pointers via "lua_newuserdatauv" or
6 * similar. Normal memory checking isn't done as lua will throw a high level
7 * error if malloc fails. Must keep this in mind while allocating data so any
· · ·
18static void *mcp_profile_alloc(void *ud, void *ptr, size_t osize, size_t nsize);
19
20/******** EXTERNAL FUNCTIONS ******/
21// functions starting with _ are breakouts for the public functions.
22
· · ·
21// functions starting with _ are breakouts for the public functions.
22
23static inline void _proxy_advance_lastkb(lua_State *L, LIBEVENT_THREAD *t) {
· · ·
129 if (t->proxy_vm_gcrunning == -1) {
130 if (lua_gc(t->L, LUA_GCSTEP, 0)) {
131 // don't advance last_kb: let the main algo decide when to run.
132 t->proxy_vm_gcrunning = 0;
133 t->proxy_vm_gcpokemem = 0;
+ 54 more matches in this file
xxhash.h C HEADER 80 matches · showing 5 view file →
34 */
35/*!
36 * @mainpage xxHash
37 *
38 * @file xxhash.h
· · ·
61SHA1-32 0.28 GB/s 10
62
63Q.Score is a measure of quality of the hash function.
64It depends on successfully passing SMHasher test set.
6510 is a perfect score.
· · ·
107# undef XXH_STATIC_LINKING_ONLY /* avoid macro redef */
108# define XXH_STATIC_LINKING_ONLY
109 /* make all functions private */
110# undef XXH_PUBLIC_API
111# if defined(__GNUC__)
· · ·
116# define XXH_PUBLIC_API static __inline
117# else
118 /* note: this version may generate warnings for unused static functions */
119# define XXH_PUBLIC_API static
120# endif
· · ·
125 * as part of some previously included *.h header file.
126 * Without further action, the new include would just be ignored,
127 * and functions would effectively _not_ be inlined (silent failure).
128 * The following macros solve this situation by prefixing all inlined names,
129 * avoiding naming collision with previous inclusions.
+ 75 more matches in this file
items.c C 73 matches · showing 5 view file →
57static uint64_t cas_id = 1;
58
59static volatile int do_run_lru_maintainer_thread = 0;
60static pthread_mutex_t lru_maintainer_lock = PTHREAD_MUTEX_INITIALIZER;
61static pthread_mutex_t cas_id_lock = PTHREAD_MUTEX_INITIALIZER;
· · ·
60static pthread_mutex_t lru_maintainer_lock = PTHREAD_MUTEX_INITIALIZER;
61static pthread_mutex_t cas_id_lock = PTHREAD_MUTEX_INITIALIZER;
62
· · ·
206 * I think it might still not be safe to do linking outside of the slab lock
207 */
208item_chunk *do_item_alloc_chunk(item_chunk *ch, const size_t bytes_remain) {
209 // TODO: Should be a cleaner way of finding real size with slabber calls
210 size_t size = bytes_remain + sizeof(item_chunk);
· · ·
210 size_t size = bytes_remain + sizeof(item_chunk);
211 if (size > settings.slab_chunk_size_max)
212 size = settings.slab_chunk_size_max;
· · ·
280#ifdef NEED_ALIGN
281 // header chunk needs to be padded on some systems
282 int remain = htotal % 8;
283 if (remain != 0) {
284 htotal += 8 - remain;
+ 68 more matches in this file
crawler.c C 29 matches · showing 5 view file →
36typedef struct _crawler_module_t crawler_module_t;
37
38typedef void (*crawler_eval_func)(crawler_module_t *cm, item *it, uint32_t hv, int slab_cls);
39typedef int (*crawler_init_func)(crawler_module_t *cm, void *data); // TODO: init args?
40typedef void (*crawler_deinit_func)(crawler_module_t *cm); // TODO: extra args?
· · ·
39typedef int (*crawler_init_func)(crawler_module_t *cm, void *data); // TODO: init args?
40typedef void (*crawler_deinit_func)(crawler_module_t *cm); // TODO: extra args?
41typedef void (*crawler_doneclass_func)(crawler_module_t *cm, int slab_cls);
· · ·
40typedef void (*crawler_deinit_func)(crawler_module_t *cm); // TODO: extra args?
41typedef void (*crawler_doneclass_func)(crawler_module_t *cm, int slab_cls);
42typedef void (*crawler_finalize_func)(crawler_module_t *cm);
· · ·
41typedef void (*crawler_doneclass_func)(crawler_module_t *cm, int slab_cls);
42typedef void (*crawler_finalize_func)(crawler_module_t *cm);
43
· · ·
42typedef void (*crawler_finalize_func)(crawler_module_t *cm);
43
44typedef struct {
+ 24 more matches in this file
proxy_lua.c C 77 matches · showing 5 view file →
5#include "storage.h" // for stats call
6
7// func prototype example:
8// static int fname (lua_State *L)
9// normal library open:
· · ·
42 const struct _mcplib_statctx_s *c = cookie;
43 lua_State *L = c->L;
44 // table must be at the top when this function is called.
45 int tidx = lua_absindex(L, -1);
46
· · ·
47 // NOTE: sscanf is not great, especially with numerics due to UD for out
48 // of range data. It is safe to use here because we're generating the
49 // strings, and we don't use this function on anything that has user
50 // defined data (ie; stats proxy). Otherwise sscanf saves a lot of code so
51 // we use it here.
· · ·
98 } else if (strcmp(cmd, "proxy") == 0) {
99 process_proxy_stats(ctx, &_mcplib_append_stats, &c);
100 } else if (strcmp(cmd, "proxyfuncs") == 0) {
101 process_proxy_funcstats(ctx, &_mcplib_append_stats, &c);
102 } else if (strcmp(cmd, "proxybe") == 0) {
· · ·
101 process_proxy_funcstats(ctx, &_mcplib_append_stats, &c);
102 } else if (strcmp(cmd, "proxybe") == 0) {
103 process_proxy_bestats(ctx, &_mcplib_append_stats, &c);
+ 72 more matches in this file
proto_text.c C 13 matches · showing 5 view file →
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Functions for handling the text related protocols, original and meta.
4 */
5
· · ·
25#define _NO_TOUCH false
26
27// FIXME: use mcmc func!
28static int _process_token_len(mcp_parser_t *pr, size_t token) {
29 const char *s = pr->request + pr->tok.tokens[token];
· · ·
232 char *mid = NULL;
233
234 // TODO: move to another function.
235 if (!c->sasl_started) {
236 char *el, *st;
· · ·
296
297 // we don't actually care about the key at all; it can be anything.
298 // we do care about the size of the remaining read.
299 c->rlbytes = size + 2;
300
· · ·
582 } else if (strncmp(subcommand, "proxy", len) == 0) {
583 process_proxy_stats(settings.proxy_ctx, &append_stats, c);
584 } else if (strncmp(subcommand, "proxyfuncs", len) == 0) {
585 process_proxy_funcstats(settings.proxy_ctx, &append_stats, c);
586 } else if (strncmp(subcommand, "proxybe", len) == 0) {
+ 8 more matches in this file
storage.c C 30 matches · showing 5 view file →
22
23/*
24 * API functions
25 */
26static void storage_finalize_cb(io_pending_t *pending);
· · ·
71}
72
73// Function for the extra stats called from a protocol.
74// NOTE: This either needs a name change or a wrapper, perhaps?
75// it's defined here to reduce exposure of extstore.h to the rest of memcached
· · ·
108}
109
110// Additional storage stats for the main stats output.
111void storage_stats(ADD_STAT add_stats, void *c) {
112 struct extstore_stats st;
· · ·
215 && memcmp(resp->iov[0].iov_base, "VA ", 3) == 0) {
216 // TODO: These miss translators should use specific callback
217 // functions attached to the io wrap. This is weird :(
218 resp->iovcnt = 1;
219 resp->iov[0].iov_len = 4;
· · ·
298 if (chunked) {
299 unsigned int ciovcnt = 0;
300 size_t remain = new_it->nbytes;
301 item_chunk *chunk = (item_chunk *) ITEM_schunk(new_it);
302 // TODO: This might make sense as a _global_ cache vs a per-thread.
+ 25 more matches in this file
extstore.c C 12 matches · showing 5 view file →
84} store_io_thread;
85
86// sub-struct for maintenance related tasks.
87struct store_maint {
88 pthread_mutex_t mutex;
· · ·
87struct store_maint {
88 pthread_mutex_t mutex;
89};
· · ·
109 pthread_mutex_t stats_mutex;
110 struct extstore_stats stats;
111 struct store_maint maint;
112};
113
· · ·
115// the memcached ecosystem. worth starting a cross-utility header with static
116// definitions/macros?
117// keeping a minimal func here for now.
118#define THR_NAME_MAXLEN 16
119static void thread_setname(pthread_t thread, const char *name) {
· · ·
195void extstore_get_page_data(void *ptr, struct extstore_stats *st) {
196 store_engine *e = (store_engine *)ptr;
197 pthread_mutex_lock(&e->maint.mutex);
198 struct extstore_page_data *pd = st->page_data;
199
+ 7 more matches in this file
thread.c C 19 matches · showing 5 view file →
158 switch (type) {
159 case PAUSE_ALL_THREADS:
160 slab_maintenance_pause(settings.slab_rebal);
161 lru_maintainer_pause();
162 lru_crawler_pause();
· · ·
161 lru_maintainer_pause();
162 lru_crawler_pause();
163#ifdef EXTSTORE
· · ·
170 break;
171 case RESUME_ALL_THREADS:
172 slab_maintenance_resume(settings.slab_rebal);
173 lru_maintainer_resume();
174 lru_crawler_resume();
· · ·
173 lru_maintainer_resume();
174 lru_crawler_resume();
175#ifdef EXTSTORE
· · ·
202// MUST not be called with any deeper locks held
203// MUST be called only by parent thread
204// Note: listener thread is the "main" event base, which has exited its
205// loop in order to call this function.
206void stop_threads(void) {
+ 14 more matches in this file
proxy_config.c C 15 matches · showing 5 view file →
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2// Functions related to the configuration management threads and VM
3// TODO (v2): move worker thread related code back out of here.
4
· · ·
28static int _run_pcall(lua_State *L, int narg, int nres) {
29 int msgi = lua_gettop(L) - narg;
30 lua_pushcfunction(L, _msghandler);
31 lua_insert(L, msgi);
32 int res = lua_pcall(L, narg, nres, msgi);
· · ·
33 lua_remove(L, msgi); // need to drop the msg handler func.
34
35 return res;
· · ·
230 lua_settop(L, 0); // clear off any crud that could have been left on the stack.
231
232 // The main stages of config reload are:
233 // - load and execute the config file
234 // - run mcp_config_pools()
· · ·
287
288// Very basic scheduler. Unsorted because we don't expect a huge list of
289// functions to run.
290static void proxy_run_crons(proxy_ctx_t *ctx) {
291 lua_State *L = ctx->proxy_state;
+ 10 more matches in this file
proxy_luafgen.c C 160 matches · showing 5 view file →
6#endif
7
8static mcp_funcgen_t *mcp_funcgen_route(lua_State *L, mcp_funcgen_t *fgen, mcp_parser_t *pr);
9static int mcp_funcgen_router_cleanup(lua_State *L, mcp_funcgen_t *fgen);
10static void _mcplib_funcgen_cache(mcp_funcgen_t *fgen, mcp_rcontext_t *rctx);
· · ·
9static int mcp_funcgen_router_cleanup(lua_State *L, mcp_funcgen_t *fgen);
10static void _mcplib_funcgen_cache(mcp_funcgen_t *fgen, mcp_rcontext_t *rctx);
11static void mcp_funcgen_cleanup(lua_State *L, mcp_funcgen_t *fgen);
· · ·
10static void _mcplib_funcgen_cache(mcp_funcgen_t *fgen, mcp_rcontext_t *rctx);
11static void mcp_funcgen_cleanup(lua_State *L, mcp_funcgen_t *fgen);
12static void mcp_resume_rctx_from_cb(mcp_rcontext_t *rctx);
· · ·
11static void mcp_funcgen_cleanup(lua_State *L, mcp_funcgen_t *fgen);
12static void mcp_resume_rctx_from_cb(mcp_rcontext_t *rctx);
13static void proxy_return_rqu_cb(io_pending_t *pending);
· · ·
14
15// If we're GC'ed but not closed, it means it was created but never
16// attached to a function, so ensure everything is closed properly.
17int mcplib_funcgen_gc(lua_State *L) {
18 mcp_funcgen_t *fgen = luaL_checkudata(L, -1, "mcp.funcgen");
+ 155 more matches in this file
restart.c C 13 matches · showing 5 view file →
134}
135
136// This function advances the file read while being called directly from the
137// callback.
138// The control inversion here (callback calling in which might change the next
· · ·
220static int restart_save(const char *file) {
221 // metadata is kept in a separate file.
222 // FIXME: function.
223 size_t flen = strlen(file);
224 const char *ext = ".meta";
· · ·
359 uint64_t checked = 0;
360 const unsigned int page_size = settings.slab_page_size;
361 unsigned int page_remain = page_size;
362
363 gettimeofday(&tv, NULL);
· · ·
374 int size = slabs_fixup((char *)mmap_base + checked,
375 checked % settings.slab_page_size);
376 //fprintf(stderr, "id: %d, size: %d remain: %u\n", it->slabs_clsid, size, page_remain);
377 // slabber gobbled an entire page, skip and move on.
378 if (size == -1) {
· · ·
379 assert(page_remain % page_size == 0);
380 assert(page_remain == page_size);
381 checked += page_remain;
+ 8 more matches in this file
slabs.c C 6 matches · showing 5 view file →
39static size_t mem_malloced = 0;
40/* If the memory limit has been hit once. Used as a hint to decide when to
41 * early-wake the LRU maintenance thread */
42static bool mem_limit_reached = false;
43static int power_largest;
· · ·
99// TODO: could this work with the restartable memory?
100// Docs say hugepages only work with private shm allocs.
101/* Function split out for better error path handling */
102static void * alloc_large_chunk(const size_t limit)
103{
· · ·
206 /* Some platforms use runtime transparent hugepages. If for any reason
207 * the initial allocation fails, the required settings do not persist
208 * for remaining allocations. As such it makes little sense to do slab
209 * preallocation. */
210 bool __attribute__ ((unused)) do_slab_prealloc = false;
· · ·
527
528/* With refactoring of the various stats code the automover won't need a
529 * custom function here.
530 */
531void fill_slab_stats_automove(slab_stats_automove *am) {
· · ·
544
545/* TODO: slabs_available_chunks should grow up to encompass this.
546 * mem_flag is redundant with the other function.
547 */
548unsigned int global_page_pool_size(bool *mem_flag) {
+ 1 more matches in this file
tls.c C 7 matches · showing 5 view file →
81 // TODO: ship full error to log stream? conn events?
82 // SYSCALL specifically means we need to check errno/strerror.
83 // Else we need to look at the main error stack.
84 if (err == SSL_ERROR_SYSCALL) {
85 LOGGER_LOG(NULL, LOG_CONNEVENTS, LOGGER_CONNECTION_TLSERROR,
· · ·
109
110/*
111 * Note on setting errno in the follow functions:
112 * We either have to refactor callers of read/write/sendmsg to take an error
113 * flag to find out if we're in an EAGAIN state, or we ensure the errno is set
· · ·
122
123// TODO: add int offset, and find the nth NID here.
124// or different function that accepts a string, then does etc?
125// Caller _must immediately_ use the string and not store the pointer.
126const unsigned char *ssl_get_peer_cn(conn *c, int *len) {
· · ·
235static ssize_t ssl_sendmsg(conn *c, struct msghdr *msg, int flags) {
236 assert (c != NULL);
237 size_t buf_remain = settings.ssl_wbuf_size;
238 size_t bytes = 0;
239 size_t to_copy;
· · ·
253 for (i = 0; i < msg->msg_iovlen; i++) {
254 size_t len = msg->msg_iov[i].iov_len;
255 to_copy = len < buf_remain ? len : buf_remain;
256
257 memcpy(bp + bytes, (void*)msg->msg_iov[i].iov_base, to_copy);
+ 2 more matches in this file
proto_parser.c C 6 matches · showing 5 view file →
45 */
46
47// TODO: func to just get length of token
48static int _process_request_key(mcp_parser_t *pr) {
49 // TODO: can klen be int?
· · ·
175 // with a \r\n requirement but never did this and need backcompat.
176 // In this case we _know_ \n is at cmdlen because we can't enter this
177 // function otherwise.
178 size_t endlen = 0;
179 assert(cm[cmdlen-1] == '\n');
· · ·
421}
422
423// FIXME: use mcmc func!
424static int _process_token_len(mcp_parser_t *pr, size_t token) {
425 const char *s = pr->request + pr->tok.tokens[token];
· · ·
771 }
772
773 // vlen is validated from the main parser.
774
775 if (settings.detail_enabled) {
· · ·
1085 break;
1086 case 't':
1087 // TTL remaining as of this request.
1088 // needs to be relative because server clocks may not be in sync.
1089 META_CHAR(p, 't');
+ 1 more matches in this file
assoc.c C 28 matches · showing 5 view file →
3 * Hash table
4 *
5 * The hash function used here is by Bob Jenkins, 1996:
6 * <http://burtleburtle.net/bob/hash/doobs.html>
7 * "By Bob Jenkins, 1996. bob_jenkins@burtleburtle.net.
· · ·
26#include <pthread.h>
27
28static pthread_cond_t maintenance_cond = PTHREAD_COND_INITIALIZER;
29static pthread_mutex_t maintenance_lock = PTHREAD_MUTEX_INITIALIZER;
30
· · ·
29static pthread_mutex_t maintenance_lock = PTHREAD_MUTEX_INITIALIZER;
30
31/* how many powers of 2's worth of buckets we use */
· · ·
35#define hashmask(n) (hashsize(n)-1)
36
37/* Main hash table. This is where we look except during expansion. */
38static item** primary_hashtable = 0;
39
· · ·
142
143void assoc_start_expand(uint64_t curr_items) {
144 if (pthread_mutex_trylock(&maintenance_lock) == 0) {
145 if (curr_items > (hashsize(hashpower) * 3) / 2 && hashpower < HASHPOWER_MAX) {
146 pthread_cond_signal(&maintenance_cond);
+ 23 more matches in this file
testapp.c C 7 matches · showing 5 view file →
45};
46
47hash_func hash;
48
49static ssize_t tcp_read(struct conn *c, void *buf, size_t count);
· · ·
487
488/**
489 * Function to start the server and let it listen on a random port
490 *
491 * @param port_out where to store the TCP port number the server is
· · ·
2251}
2252
2253typedef enum test_return (*TEST_FUNC)(void);
2254struct testcase {
2255 const char *description;
· · ·
2256 TEST_FUNC function;
2257};
2258
· · ·
2318};
2319
2320/* Stub out function defined in memcached.c */
2321void STATS_LOCK(void);
2322void STATS_UNLOCK(void);
+ 2 more matches in this file
proxy_tls.c C 6 matches · showing 5 view file →
33 }
34
35 // TODO: make configurable like main cache server
36 SSL_CTX_set_min_proto_version(tctx, TLS1_3_VERSION);
37 // reduce memory consumption of idle backends.
· · ·
83}
84
85// Contrary to the name of this function, the underlying tcp socket must
86// already be connected.
87int mcp_tls_connect(struct mcp_backendconn_s *be) {
· · ·
216 }
217 }
218 size_t remain = et->tls_wbuf_size;
219 char *b = et->tls_wbuf;
220
· · ·
223 for (int i = 0; i < iovcnt; i++) {
224 size_t len = be->write_iovs[i].iov_len;
225 size_t to_copy = len < remain ? len : remain;
226
227 memcpy(b, (char *)be->write_iovs[i].iov_base, to_copy);
· · ·
228 remain -= to_copy;
229 b += to_copy;
230 if (remain == 0)
+ 1 more matches in this file
crc32c.c C 4 matches view file →
45#include "crc32c.h"
46
47crc_func crc32c;
48
49/* CRC-32C (iSCSI) polynomial in reversed bit order. */
· · ·
200 }
201
202 /* do the same thing, but now on SHORT*3 blocks for the remaining data less
203 than a LONG*3 block */
204 while (len >= SHORT*3) {
· · ·
220 }
221
222 /* compute the crc on the remaining eight-byte units less than a SHORT*3
223 block */
224 {
· · ·
501 hardware instructions. Determine the endianess of the processor and proceed
502 accordingly. Ideally the endianess will be determined at compile time, in
503 which case the unused functions and tables for the other endianess will be
504 removed by the optimizer. If not, then the proper routines and tables will
505 be used, even if the endianess is changed mid-stream. (Yes, there are
memcached.h C HEADER 18 matches · showing 5 view file →
2
3/** \file
4 * The main memcached header holding commonly used data
5 * structures and function prototypes.
6 */
· · ·
5 * structures and function prototypes.
6 */
7
· · ·
127#define TAIL_REPAIR_TIME_DEFAULT 0
128
129/* warning: don't use these macros with a function, as it evals its arg twice */
130#define ITEM_get_cas(i) (((i)->it_flags & ITEM_CAS) ? \
131 (i)->data->cas : (uint64_t)0)
· · ·
198
199/**
200 * Callback for any function producing stats.
201 *
202 * @param key the stat's key
· · ·
211
212/*
213 * NOTE: If you modify this table you _MUST_ update the function state_text
214 */
215/**
+ 13 more matches in this file
proxy_internal.c C 4 matches view file →
1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2// Functions related to local command execution.
3
4#include "proxy.h"
· · ·
12#define _NO_TOUCH false
13
14// FIXME: func or macro from storage for crc check
15#ifdef EXTSTORE
16static void _storage_get_item_cb(void *e, obj_io *eio, int ret) {
· · ·
137 if (should_touch) {
138 if (!mc_parse_exptime(resp, pr, 1, &exptime)) {
139 // function fills resp with error.
140 return;
141 }
· · ·
219 // object to have full support (ie: resp:line()/etc) it might be necessary
220 // to still do a full parsing. It might be possible to
221 // wrap the main commands with something that decorates r->resp directly
222 // instead of going through a parser to save some CPU.
223 // Either way this is a lot less code.
t/proxyfuncgen.lua LUA 98 matches · showing 5 view file →
1-- New style request factories and backend request handling.
2--
3-- First, this API adds a "request func generation" step when a new request
4-- starts: if there is not already a cached function to use, call the
5-- "generator" function, then use the response to run the request. This generated
· · ·
4-- starts: if there is not already a cached function to use, call the
5-- "generator" function, then use the response to run the request. This generated
6-- function is reused until the parent generator is swapped out during reload.
· · ·
5-- "generator" function, then use the response to run the request. This generated
6-- function is reused until the parent generator is swapped out during reload.
7-- This allows the user to pre-allocate and pre-calculate objects and data,
· · ·
6-- function is reused until the parent generator is swapped out during reload.
7-- This allows the user to pre-allocate and pre-calculate objects and data,
8-- offering both safety and performance.
· · ·
22-- The queueing system is now recursive: a fgen can new_handle() another fgen.
23-- Meaning configurations can be assembled as call graphs. IE: If you have a
24-- route function A and want to "shadow" some of its requests onto route
25-- function B, instead of making A more complex you can create a third
26-- function C which splits the traffic.
+ 93 more matches in this file
proxy.h C HEADER 45 matches · showing 5 view file →
74 mcp_memp_string,
75 mcp_memp_table,
76 mcp_memp_func,
77 mcp_memp_userdata,
78 mcp_memp_thread,
· · ·
88};
89
90// for various time conversion functions
91#define NANOSECONDS(x) ((x) * 1E9 + 0.5)
92#define MICROSECONDS(x) ((x) * 1E6 + 0.5)
· · ·
182typedef STAILQ_HEAD(globalobj_head_s, mcp_globalobj_s) globalobj_head_t;
183typedef struct {
184 lua_State *proxy_state; // main configuration vm
185 proxy_event_thread_t *proxy_io_thread;
186 int64_t active_req_limit; // max total in-flight requests
· · ·
226struct proxy_hook_ref {
227 int lua_ref;
228 void *ctx; // if we're a generator based function.
229};
230
· · ·
240};
241
242// TODO (v2): some hash functions (crc?) might require initializers. If we run into
243// any the interface might need expanding.
244typedef uint64_t (*key_hash_func)(const void *key, size_t len, uint64_t seed);
+ 40 more matches in this file
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.