struct item *item= get_item(key, keylen);
if (item == NULL)
{
- item= create_item(key, keylen, NULL, sizeof(initial), 0, expiration);
+ item= create_item(key, keylen, NULL, sizeof(initial), 0, (time_t)expiration);
if (item == NULL)
{
rval= PROTOCOL_BINARY_RESPONSE_ENOMEM;
size_t datalen= ntohl(header->request.bodylen) - keylen - 8;
protocol_binary_request_replace *request= (void*)header;
uint32_t flags= ntohl(request->message.body.flags);
- time_t timeout= ntohl(request->message.body.expiration);
+ time_t timeout= (time_t)ntohl(request->message.body.expiration);
char *key= ((char*)header) + sizeof(*header) + 8;
char *data= key + keylen;
size_t datalen= ntohl(header->request.bodylen) - keylen - 8;
protocol_binary_request_add *request= (void*)header;
uint32_t flags= ntohl(request->message.body.flags);
- time_t timeout= ntohl(request->message.body.expiration);
+ time_t timeout= (time_t)ntohl(request->message.body.expiration);
char *key= ((char*)header) + sizeof(*header) + 8;
char *data= key + keylen;
size_t datalen= ntohl(header->request.bodylen) - keylen - 8;
protocol_binary_request_replace *request= (void*)header;
uint32_t flags= ntohl(request->message.body.flags);
- time_t timeout= ntohl(request->message.body.expiration);
+ time_t timeout= (time_t)ntohl(request->message.body.expiration);
char *key= ((char*)header) + sizeof(*header) + 8;
char *data= key + keylen;
struct item* item= get_item(key, keylen);
if (item == NULL)
{
- item= create_item(key, keylen, data, datalen, flags, exptime);
+ item= create_item(key, keylen, data, datalen, flags, (time_t)exptime);
if (item == 0)
{
rval= PROTOCOL_BINARY_RESPONSE_ENOMEM;
delete_item(key, keylen);
}
- item= create_item(key, keylen, NULL, sizeof(initial), 0, expiration);
+ item= create_item(key, keylen, NULL, sizeof(initial), 0, (time_t)expiration);
if (item == 0)
{
rval= PROTOCOL_BINARY_RESPONSE_ENOMEM;
delete_item(key, keylen);
}
- item= create_item(key, keylen, NULL, sizeof(initial), 0, expiration);
+ item= create_item(key, keylen, NULL, sizeof(initial), 0, (time_t)expiration);
if (item == NULL)
{
rval= PROTOCOL_BINARY_RESPONSE_ENOMEM;
else if (cas == 0 || cas == item->cas)
{
delete_item(key, keylen);
- item= create_item(key, keylen, data, datalen, flags, exptime);
+ item= create_item(key, keylen, data, datalen, flags, (time_t)exptime);
if (item == 0)
{
rval= PROTOCOL_BINARY_RESPONSE_ENOMEM;
}
delete_item(key, keylen);
- struct item* item= create_item(key, keylen, data, datalen, flags, exptime);
+ struct item* item= create_item(key, keylen, data, datalen, flags, (time_t)exptime);
if (item == 0)
{
rval= PROTOCOL_BINARY_RESPONSE_ENOMEM;
#include "storage.h"
-const char *tablename = "memcached/items";
+const char *tablename= "memcached/items";
#define key_col_idx 0
#define data_col_idx 1
*/
static bool create_schema(void) {
ib_tbl_sch_t schema= NULL;
- ib_idx_sch_t index= NULL;
+ ib_idx_sch_t dbindex= NULL;
if (ib_database_create("memcached") != IB_TRUE)
{
IB_COL_UNSIGNED, 0, 8));
checked(ib_table_schema_add_col(schema, "exp", IB_INT,
IB_COL_UNSIGNED, 0, 4));
- checked(ib_table_schema_add_index(schema, "PRIMARY_KEY", &index));
- checked(ib_index_schema_add_col(index, "key", 0));
- checked(ib_index_schema_set_clustered(index));
+ checked(ib_table_schema_add_index(schema, "PRIMARY_KEY", &dbindex));
+ checked(ib_index_schema_add_col(dbindex, "key", 0));
+ checked(ib_index_schema_set_clustered(dbindex));
checked(ib_schema_lock_exclusive(transaction));
checked(ib_table_create(transaction, schema, &table_id));
checked(ib_trx_commit(transaction));
* @param item the item to store
* @return true if we can go ahead and commit the transaction, false otherwise
*/
-bool do_put_item(ib_trx_t trx, struct item* item) {
+static bool do_put_item(ib_trx_t trx, struct item* item) {
update_cas(item);
- ib_crsr_t cursor = NULL;
+ ib_crsr_t cursor= NULL;
ib_tpl_t tuple= NULL;
- bool retval = false;
+ bool retval= false;
checked(ib_cursor_open_table(tablename, trx, &cursor));
checked(ib_cursor_lock(cursor, IB_LOCK_X));
checked(ib_col_set_value(tuple, data_col_idx, item->data, item->size));
checked(ib_tuple_write_u32(tuple, flags_col_idx, item->flags));
checked(ib_tuple_write_u64(tuple, cas_col_idx, item->cas));
- checked(ib_tuple_write_u32(tuple, exp_col_idx, item->exp));
+ checked(ib_tuple_write_u32(tuple, exp_col_idx, (ib_u32_t)item->exp));
checked(ib_cursor_insert_row(cursor, tuple));
retval= true;
ib_crsr_t *cursor)
{
int res;
- ib_tpl_t tuple;
+ ib_tpl_t tuple= NULL;
- *cursor = NULL;
+ *cursor= NULL;
checked(ib_cursor_open_table(tablename, trx, cursor));
tuple= ib_clust_search_tuple_create(*cursor);
if (explen != 0) {
ib_u32_t val;
checked(ib_tuple_read_u32(tuple, exp_col_idx, &val));
- retval->exp= (uint32_t)val;
+ retval->exp= (time_t)val;
}
}
{
checked(ib_cursor_lock(cursor, IB_LOCK_X));
checked(ib_cursor_delete_row(cursor));
- retval = true;
+ retval= true;
}
/* Release resources */
/* FALLTHROUGH */
* Flush the entire cache
* @param when when the cache should be flushed (0 == immediately)
*/
-void flush(uint32_t when) {
+void flush(uint32_t when __attribute__((unused))) {
/* @TODO implement support for when != 0 */
ib_trx_t transaction= ib_trx_begin(IB_TRX_REPEATABLE_READ);
ib_crsr_t cursor= NULL;