MySQL 5.6.14 Source Code Document
|
#include <event.h>
#include <pthread.h>
#include <config_static.h>
#include <memcached/protocol_binary.h>
#include <memcached/engine.h>
#include <memcached/extension.h>
#include "cache.h"
#include "topkeys.h"
#include "sasl_defs.h"
#include "stats.h"
#include "trace.h"
#include "hash.h"
#include <memcached/util.h>
Go to the source code of this file.
Classes | |
struct | slab_stats |
struct | thread_stats |
struct | independent_stats |
struct | stats |
struct | settings |
struct | engine_event_handler |
struct | LIBEVENT_THREAD |
struct | conn |
Macros | |
#define | KEY_MAX_LENGTH 250 |
#define | INCR_MAX_STORAGE_LEN 24 |
#define | DATA_BUFFER_SIZE 2048 |
#define | UDP_READ_BUFFER_SIZE 65536 |
#define | UDP_MAX_PAYLOAD_SIZE 1400 |
#define | UDP_HEADER_SIZE 8 |
#define | MAX_SENDBUF_SIZE (256 * 1024 * 1024) |
#define | SUFFIX_SIZE 24 |
#define | ITEM_LIST_INITIAL 200 |
#define | SUFFIX_LIST_INITIAL 20 |
#define | IOV_LIST_INITIAL 400 |
#define | MSG_LIST_INITIAL 10 |
#define | READ_BUFFER_HIGHWAT 8192 |
#define | ITEM_LIST_HIGHWAT 400 |
#define | IOV_LIST_HIGHWAT 600 |
#define | MSG_LIST_HIGHWAT 100 |
#define | MIN_BIN_PKT_LENGTH 16 |
#define | BIN_PKT_HDR_WORDS (MIN_BIN_PKT_LENGTH/sizeof(uint32_t)) |
#define | POWER_SMALLEST 1 |
#define | POWER_LARGEST 200 |
#define | CHUNK_ALIGN_BYTES 8 |
#define | DONT_PREALLOC_SLABS |
#define | MAX_NUMBER_OF_SLAB_CLASSES (POWER_LARGEST + 1) |
#define | STAT_KEY_LEN 128 |
#define | STAT_VAL_LEN 128 |
#define | DEFAULT_REQS_PER_EVENT 20 |
#define | DEFAULT_REQS_PER_TAP_EVENT 50 |
#define | APPEND_STAT(name, fmt, val) append_stat(name, add_stats, c, fmt, val); |
#define | APPEND_NUM_FMT_STAT(name_fmt, num, name, fmt, val) |
#define | APPEND_NUM_STAT(num, name, fmt, val) APPEND_NUM_FMT_STAT("%d:%s", num, name, fmt, val) |
#define | IS_UDP(x) (x == udp_transport) |
#define | MAX_VERBOSITY_LEVEL 2 |
#define | LOCK_THREAD(t) |
#define | UNLOCK_THREAD(t) |
#define | LIST_STATE_PROCESSING 1 |
#define | LIST_STATE_REQ_PENDING_IO 2 |
#define | LIST_STATE_REQ_PENDING_CLOSE 4 |
#define | drop_privileges() |
#define | __builtin_expect(x, expected_value) (x) |
#define | likely(x) __builtin_expect((x),1) |
#define | unlikely(x) __builtin_expect((x),0) |
Typedefs | |
typedef struct conn | conn |
typedef bool(* | STATE_FUNC )(conn *) |
Functions | |
void | notify_thread (LIBEVENT_THREAD *thread) |
void | notify_dispatcher (void) |
bool | create_notification_pipe (LIBEVENT_THREAD *me) |
conn * | conn_new (const SOCKET sfd, STATE_FUNC init_state, const int event_flags, const int read_buffer_size, enum network_transport transport, struct event_base *base, struct timeval *timeout) |
int | daemonize (int nochdir, int noclose) |
bool | register_event (conn *c, struct timeval *timeout) |
bool | unregister_event (conn *c) |
bool | update_event (conn *c, const int new_flags) |
void | thread_init (int nthreads, struct event_base *main_base, void(*dispatcher_callback)(int, short, void *)) |
void | threads_shutdown (void) |
int | dispatch_event_add (int thread, conn *c) |
void | dispatch_conn_new (SOCKET sfd, STATE_FUNC init_state, int event_flags, int read_buffer_size, enum network_transport transport) |
void | accept_new_conns (const bool do_accept) |
conn * | conn_from_freelist (void) |
bool | conn_add_to_freelist (conn *c) |
int | is_listen_thread (void) |
void | STATS_LOCK (void) |
void | STATS_UNLOCK (void) |
void | threadlocal_stats_clear (struct thread_stats *stats) |
void | threadlocal_stats_reset (struct thread_stats *thread_stats) |
void | threadlocal_stats_aggregate (struct thread_stats *thread_stats, struct thread_stats *stats) |
void | slab_stats_aggregate (struct thread_stats *stats, struct slab_stats *out) |
void | append_stat (const char *name, ADD_STAT add_stats, conn *c, const char *fmt,...) |
void | notify_io_complete (const void *cookie, ENGINE_ERROR_CODE status) |
void | conn_set_state (conn *c, STATE_FUNC state) |
const char * | state_text (STATE_FUNC state) |
void | safe_close (SOCKET sfd) |
int | number_of_pending (conn *c, conn *pending) |
bool | has_cycle (conn *c) |
bool | list_contains (conn *h, conn *n) |
conn * | list_remove (conn *h, conn *n) |
size_t | list_to_array (conn **dest, size_t max_items, conn **l) |
void | enlist_conn (conn *c, conn **list) |
void | finalize_list (conn **list, size_t items) |
bool | set_socket_nonblocking (SOCKET sfd) |
void | conn_close (conn *c) |
bool | conn_listening (conn *c) |
bool | conn_new_cmd (conn *c) |
bool | conn_waiting (conn *c) |
bool | conn_read (conn *c) |
bool | conn_parse_cmd (conn *c) |
bool | conn_write (conn *c) |
bool | conn_nread (conn *c) |
bool | conn_swallow (conn *c) |
bool | conn_pending_close (conn *c) |
bool | conn_immediate_close (conn *c) |
bool | conn_closing (conn *c) |
bool | conn_mwrite (conn *c) |
bool | conn_ship_log (conn *c) |
bool | conn_add_tap_client (conn *c) |
bool | conn_setup_tap_stream (conn *c) |
Variables | |
struct stats | stats |
struct settings | settings |
LIBEVENT_THREAD * | tap_thread |
The main memcached header holding commonly used data structures and function prototypes.
Definition in file memcached.h.
Append an indexed stat with a stat name (with format), value format and value
Definition at line 79 of file memcached.h.
#define APPEND_NUM_STAT | ( | num, | |
name, | |||
fmt, | |||
val | |||
) | APPEND_NUM_FMT_STAT("%d:%s", num, name, fmt, val) |
Common APPEND_NUM_FMT_STAT format.
Definition at line 85 of file memcached.h.
Append a simple stat with a stat name, value format and value
Definition at line 74 of file memcached.h.
#define INCR_MAX_STORAGE_LEN 24 |
Size of an incr buf.
Definition at line 26 of file memcached.h.
#define IOV_LIST_INITIAL 400 |
Initial size of the sendmsg() scatter/gather array.
Definition at line 44 of file memcached.h.
#define ITEM_LIST_INITIAL 200 |
Initial size of list of items being returned by "get".
Definition at line 38 of file memcached.h.
#define KEY_MAX_LENGTH 250 |
Maximum length of a key.
Definition at line 23 of file memcached.h.
#define LOCK_THREAD | ( | t | ) |
Definition at line 248 of file memcached.h.
#define MSG_LIST_INITIAL 10 |
Initial number of sendmsg() argument structures to allocate.
Definition at line 47 of file memcached.h.
#define READ_BUFFER_HIGHWAT 8192 |
High water marks for buffer shrinking
Definition at line 50 of file memcached.h.
#define SUFFIX_LIST_INITIAL 20 |
Initial size of list of CAS suffixes appended to "gets" lines.
Definition at line 41 of file memcached.h.
#define UNLOCK_THREAD | ( | t | ) |
Definition at line 255 of file memcached.h.
bool conn_ship_log | ( | conn * | c | ) |
Ship tap log to the other end. This state differs with all other states in the way that it support full duplex dialog. We're listening to both read and write events from libevent most of the time. If a read event occurs we switch to the conn_read state to read and execute the input message (that would be an ack message from the other side). If a write event occurs we continue to send tap log to the other end.
c | the tap connection to drive |
Definition at line 5160 of file memcached.c.
const char* state_text | ( | STATE_FUNC | state | ) |
Convert a state name to a human readable form.
Definition at line 803 of file memcached.c.
exported globals
Definition at line 170 of file memcached.c.