memcached.h | memcached.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
typedef struct memcached_st memcached_st; | typedef struct memcached_st memcached_st; | |||
typedef struct memcached_stat_st memcached_stat_st; | typedef struct memcached_stat_st memcached_stat_st; | |||
typedef struct memcached_string_st memcached_string_st; | typedef struct memcached_string_st memcached_string_st; | |||
typedef struct memcached_server_st memcached_server_st; | typedef struct memcached_server_st memcached_server_st; | |||
#define MEMCACHED_DEFAULT_PORT 11211 | #define MEMCACHED_DEFAULT_PORT 11211 | |||
#define MEMCACHED_DEFAULT_COMMAND_SIZE 350 | #define MEMCACHED_DEFAULT_COMMAND_SIZE 350 | |||
#define SMALL_STRING_LEN 1024 | #define SMALL_STRING_LEN 1024 | |||
#define HUGE_STRING_LEN 8196 | #define HUGE_STRING_LEN 8196 | |||
#define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ | #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */ | |||
//#define MEMCACHED_MAX_BUFFER 8196 | ||||
#define MEMCACHED_MAX_BUFFER 8196 | ||||
typedef enum { | typedef enum { | |||
MEMCACHED_SUCCESS, | MEMCACHED_SUCCESS, | |||
MEMCACHED_FAILURE, | MEMCACHED_FAILURE, | |||
MEMCACHED_HOST_LOCKUP_FAILURE, | MEMCACHED_HOST_LOCKUP_FAILURE, | |||
MEMCACHED_CONNECTION_FAILURE, | MEMCACHED_CONNECTION_FAILURE, | |||
MEMCACHED_CONNECTION_BIND_FAILURE, | MEMCACHED_CONNECTION_BIND_FAILURE, | |||
MEMCACHED_WRITE_FAILURE, | MEMCACHED_WRITE_FAILURE, | |||
MEMCACHED_READ_FAILURE, | MEMCACHED_READ_FAILURE, | |||
MEMCACHED_UNKNOWN_READ_FAILURE, | MEMCACHED_UNKNOWN_READ_FAILURE, | |||
MEMCACHED_PROTOCOL_ERROR, | MEMCACHED_PROTOCOL_ERROR, | |||
MEMCACHED_CLIENT_ERROR, | MEMCACHED_CLIENT_ERROR, | |||
MEMCACHED_SERVER_ERROR, | MEMCACHED_SERVER_ERROR, | |||
MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE, | MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE, | |||
MEMCACHED_DATA_EXISTS, | MEMCACHED_DATA_EXISTS, | |||
MEMCACHED_DATA_DOES_NOT_EXIST, | MEMCACHED_DATA_DOES_NOT_EXIST, | |||
MEMCACHED_NOTSTORED, | MEMCACHED_NOTSTORED, | |||
MEMCACHED_STORED, | ||||
MEMCACHED_NOTFOUND, | MEMCACHED_NOTFOUND, | |||
MEMCACHED_MEMORY_ALLOCATION_FAILURE, | MEMCACHED_MEMORY_ALLOCATION_FAILURE, | |||
MEMCACHED_PARTIAL_READ, | MEMCACHED_PARTIAL_READ, | |||
MEMCACHED_SOME_ERRORS, | MEMCACHED_SOME_ERRORS, | |||
MEMCACHED_NO_SERVERS, | MEMCACHED_NO_SERVERS, | |||
MEMCACHED_END, | MEMCACHED_END, | |||
MEMCACHED_DELETED, | MEMCACHED_DELETED, | |||
MEMCACHED_VALUE, | MEMCACHED_VALUE, | |||
MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */ | MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */ | |||
} memcached_return; | } memcached_return; | |||
typedef enum { | typedef enum { | |||
MEMCACHED_BEHAVIOR_NO_BLOCK, | ||||
MEMCACHED_BEHAVIOR_BLOCK, | ||||
} memcached_behavior; | ||||
typedef enum { | ||||
MEMCACHED_NOT_ALLOCATED= 0, | MEMCACHED_NOT_ALLOCATED= 0, | |||
MEMCACHED_ALLOCATED= 1, | MEMCACHED_ALLOCATED= 1, | |||
} memcached_allocated; | } memcached_allocated; | |||
struct memcached_server_st { | struct memcached_server_st { | |||
char *hostname; | char *hostname; | |||
unsigned int port; | unsigned int port; | |||
int fd; | int fd; | |||
}; | }; | |||
skipping to change at line 109 | skipping to change at line 117 | |||
unsigned long long cmd_get; | unsigned long long cmd_get; | |||
unsigned long long cmd_set; | unsigned long long cmd_set; | |||
unsigned long long get_hits; | unsigned long long get_hits; | |||
unsigned long long get_misses; | unsigned long long get_misses; | |||
unsigned long long evictions; | unsigned long long evictions; | |||
unsigned long long bytes_read; | unsigned long long bytes_read; | |||
unsigned long long bytes_written; | unsigned long long bytes_written; | |||
unsigned int limit_maxbytes; | unsigned int limit_maxbytes; | |||
}; | }; | |||
#define MEM_NO_BLOCK (1 << 0) | ||||
struct memcached_string_st { | struct memcached_string_st { | |||
char *string; | char *string; | |||
char *end; | char *end; | |||
size_t current_size; | size_t current_size; | |||
size_t block_size; | size_t block_size; | |||
}; | }; | |||
struct memcached_st { | struct memcached_st { | |||
memcached_allocated is_allocated; | memcached_allocated is_allocated; | |||
memcached_server_st *hosts; | memcached_server_st *hosts; | |||
unsigned int number_of_hosts; | unsigned int number_of_hosts; | |||
unsigned int cursor_server; | unsigned int cursor_server; | |||
char read_buffer[MEMCACHED_MAX_BUFFER]; | ||||
size_t read_buffer_length; | ||||
char *read_ptr; | ||||
char write_buffer[MEMCACHED_MAX_BUFFER]; | ||||
size_t write_buffer_offset; | ||||
char connected; | char connected; | |||
int my_errno; | ||||
unsigned int stack_responses; | ||||
unsigned long long flags; | ||||
memcached_return warning; /* Future Use */ | ||||
}; | }; | |||
/* Public API */ | /* Public API */ | |||
memcached_st *memcached_create(memcached_st *ptr); | memcached_st *memcached_create(memcached_st *ptr); | |||
void memcached_free(memcached_st *ptr); | void memcached_free(memcached_st *ptr); | |||
memcached_return memcached_delete(memcached_st *ptr, char *key, size_t key_ length, | memcached_return memcached_delete(memcached_st *ptr, char *key, size_t key_ length, | |||
time_t expiration); | time_t expiration); | |||
memcached_return memcached_increment(memcached_st *ptr, | memcached_return memcached_increment(memcached_st *ptr, | |||
char *key, size_t key_length, | char *key, size_t key_length, | |||
skipping to change at line 145 | skipping to change at line 164 | |||
char *key, size_t key_length, | char *key, size_t key_length, | |||
unsigned int offset, | unsigned int offset, | |||
unsigned int *value); | unsigned int *value); | |||
memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_ return *error); | memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_ return *error); | |||
memcached_return memcached_stat_servername(memcached_stat_st *stat, char *a rgs, | memcached_return memcached_stat_servername(memcached_stat_st *stat, char *a rgs, | |||
char *hostname, unsigned int por t); | char *hostname, unsigned int por t); | |||
memcached_return memcached_flush(memcached_st *ptr, time_t expiration); | memcached_return memcached_flush(memcached_st *ptr, time_t expiration); | |||
memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbos ity); | memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbos ity); | |||
void memcached_quit(memcached_st *ptr); | void memcached_quit(memcached_st *ptr); | |||
char *memcached_strerror(memcached_st *ptr, memcached_return rc); | char *memcached_strerror(memcached_st *ptr, memcached_return rc); | |||
memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavi or flag, void *data); | ||||
/* All of the functions for adding data to the server */ | /* All of the functions for adding data to the server */ | |||
memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_len gth, | memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_len gth, | |||
char *value, size_t value_length, | char *value, size_t value_length, | |||
time_t expiration, | time_t expiration, | |||
uint16_t flags); | uint16_t flags); | |||
memcached_return memcached_add(memcached_st *ptr, char *key, size_t key_len gth, | memcached_return memcached_add(memcached_st *ptr, char *key, size_t key_len gth, | |||
char *value, size_t value_length, | char *value, size_t value_length, | |||
time_t expiration, | time_t expiration, | |||
uint16_t flags); | uint16_t flags); | |||
skipping to change at line 215 | skipping to change at line 235 | |||
memcached_return memcached_string_append_character(memcached_st *ptr, | memcached_return memcached_string_append_character(memcached_st *ptr, | |||
memcached_string_st *str ing, | memcached_string_st *str ing, | |||
char character); | char character); | |||
memcached_return memcached_string_append(memcached_st *ptr, memcached_strin g_st *string, | memcached_return memcached_string_append(memcached_st *ptr, memcached_strin g_st *string, | |||
char *value, size_t length); | char *value, size_t length); | |||
size_t memcached_string_backspace(memcached_st *ptr, memcached_string_st *s tring, size_t remove); | size_t memcached_string_backspace(memcached_st *ptr, memcached_string_st *s tring, size_t remove); | |||
memcached_return memcached_string_reset(memcached_st *ptr, memcached_string _st *string); | memcached_return memcached_string_reset(memcached_st *ptr, memcached_string _st *string); | |||
void memcached_string_free(memcached_st *ptr, memcached_string_st *string); | void memcached_string_free(memcached_st *ptr, memcached_string_st *string); | |||
/* Some personal debugging functions */ | /* Some personal debugging functions */ | |||
#define WATCHPOINT printf("WATCHPOINT %s:%d\n", __FILE__, __LINE__);fflush( | #define WATCHPOINT printf("\nWATCHPOINT %s:%d (%s)\n", __FILE__, __LINE__,_ | |||
stdout); | _func__);fflush(stdout); | |||
#define WATCHPOINT_ERROR(A) printf("WATCHPOINT %s:%d %s\n", __FILE__, __LIN | #define WATCHPOINT_ERROR(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __L | |||
E__, memcached_strerror(NULL, A));fflush(stdout); | INE__, memcached_strerror(NULL, A));fflush(stdout); | |||
#define WATCHPOINT_STRING(A) printf("WATCHPOINT %s:%d %s\n", __FILE__, __LI | #define WATCHPOINT_STRING(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __ | |||
NE__, A);fflush(stdout); | LINE__, A);fflush(stdout); | |||
#define WATCHPOINT_NUMBER(A) printf("WATCHPOINT %s:%d %d\n", __FILE__, __LI | #define WATCHPOINT_NUMBER(A) printf("\nWATCHPOINT %s:%d %d\n", __FILE__, __ | |||
NE__, A);fflush(stdout); | LINE__, A);fflush(stdout); | |||
#define WATCHPOINT_ERRNO(A) printf("\nWATCHPOINT %s:%d %s\n", __FILE__, __L | ||||
INE__, strerror(A));A= 0;fflush(stdout); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* __MEMCACHED_H__ */ | #endif /* __MEMCACHED_H__ */ | |||
End of changes. 8 change blocks. | ||||
8 lines changed or deleted | 30 lines changed or added | |||