2013-04-16 23:59:59 -04:00
/* -*- mode: C; c-basic-offset: 4 -*- */
2013-04-17 00:00:35 -04:00
# ifndef FT_CACHETABLE_WRAPPERS_H
# define FT_CACHETABLE_WRAPPERS_H
2013-04-16 23:59:59 -04:00
# ident "$Id$"
# ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
# ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11 / 760379 and to the patents and / or patent applications resulting from it."
2013-04-17 00:00:35 -04:00
# include <fttypes.h>
2013-04-17 00:00:09 -04:00
# include "cachetable.h"
2013-04-16 23:59:59 -04:00
2013-04-16 23:59:59 -04:00
/**
2013-04-16 23:59:59 -04:00
* Put an empty node ( that is , no fields filled ) into the cachetable .
* In the process , write dependent nodes out for checkpoint if
* necessary .
2013-04-16 23:59:59 -04:00
*/
2013-04-16 23:59:59 -04:00
void
cachetable_put_empty_node_with_dep_nodes (
2013-04-17 00:00:35 -04:00
FT h ,
2013-04-16 23:59:59 -04:00
u_int32_t num_dependent_nodes ,
2013-04-17 00:00:35 -04:00
FTNODE * dependent_nodes ,
2013-04-16 23:59:59 -04:00
BLOCKNUM * name , //output
u_int32_t * fullhash , //output
2013-04-17 00:00:35 -04:00
FTNODE * result
2013-04-16 23:59:59 -04:00
) ;
2013-04-16 23:59:59 -04:00
/**
2013-04-17 00:00:35 -04:00
* Create a new ftnode with specified height and number of children .
2013-04-16 23:59:59 -04:00
* In the process , write dependent nodes out for checkpoint if
* necessary .
2013-04-16 23:59:59 -04:00
*/
2013-04-16 23:59:59 -04:00
void
2013-04-17 00:00:35 -04:00
create_new_ftnode_with_dep_nodes (
FT h ,
FTNODE * result ,
2013-04-16 23:59:59 -04:00
int height ,
int n_children ,
u_int32_t num_dependent_nodes ,
2013-04-17 00:00:35 -04:00
FTNODE * dependent_nodes
2013-04-16 23:59:59 -04:00
) ;
2013-04-16 23:59:59 -04:00
/**
2013-04-17 00:00:35 -04:00
* Create a new ftnode with specified height
2013-04-16 23:59:59 -04:00
* and children .
* Used for test functions only .
2013-04-16 23:59:59 -04:00
*/
2013-04-16 23:59:59 -04:00
void
2013-04-17 00:00:35 -04:00
toku_create_new_ftnode (
FT_HANDLE t ,
FTNODE * result ,
2013-04-16 23:59:59 -04:00
int height ,
int n_children
) ;
2013-04-16 23:59:59 -04:00
/**
2013-04-17 00:00:35 -04:00
* toku_pin_ftnode either pins a ftnode , if the operation is fast ( because
2013-04-17 00:00:24 -04:00
* a partial fetch is not required and there is no contention for the node )
* or it returns TOKUDB_TRY_AGAIN after unlocking its ancestors ( using
* unlockers and ancestors ) and bringing the necessary pieces of the node
* into memory .
2013-04-16 23:59:59 -04:00
*/
2013-04-16 23:59:59 -04:00
int
2013-04-17 00:00:35 -04:00
toku_pin_ftnode (
FT_HANDLE brt ,
2013-04-16 23:59:59 -04:00
BLOCKNUM blocknum ,
u_int32_t fullhash ,
UNLOCKERS unlockers ,
ANCESTORS ancestors ,
const PIVOT_BOUNDS pbounds ,
2013-04-17 00:00:35 -04:00
FTNODE_FETCH_EXTRA bfe ,
2013-04-17 00:00:13 -04:00
BOOL may_modify_node ,
2013-04-16 23:59:59 -04:00
BOOL apply_ancestor_messages , // this BOOL is probably temporary, for #3972, once we know how range query estimates work, will revisit this
2013-04-17 00:00:35 -04:00
FTNODE * node_p ,
2013-04-17 00:00:11 -04:00
BOOL * msgs_applied
2013-04-17 00:00:24 -04:00
) ;
2013-04-16 23:59:59 -04:00
2013-04-16 23:59:59 -04:00
/**
2013-04-17 00:00:24 -04:00
* Unfortunately , this function is poorly named
* as over time , client threads have also started
* calling this function .
2013-04-17 00:00:35 -04:00
* This function returns a pinned ftnode to the caller .
* Unlike toku_pin_ftnode , this function blocks until the node is pinned .
2013-04-16 23:59:59 -04:00
*/
void
2013-04-17 00:00:35 -04:00
toku_pin_ftnode_off_client_thread (
FT h ,
2013-04-16 23:59:59 -04:00
BLOCKNUM blocknum ,
u_int32_t fullhash ,
2013-04-17 00:00:35 -04:00
FTNODE_FETCH_EXTRA bfe ,
2013-04-17 00:00:13 -04:00
BOOL may_modify_node ,
2013-04-16 23:59:59 -04:00
u_int32_t num_dependent_nodes ,
2013-04-17 00:00:35 -04:00
FTNODE * dependent_nodes ,
FTNODE * node_p
2013-04-16 23:59:59 -04:00
) ;
/**
2013-04-16 23:59:59 -04:00
* Effect : Unpin a brt node . Used for
* nodes that were pinned off client thread .
2013-04-16 23:59:59 -04:00
*/
2013-04-16 23:59:59 -04:00
void
2013-04-17 00:00:35 -04:00
toku_unpin_ftnode_off_client_thread ( FT h , FTNODE node ) ;
2013-04-16 23:59:59 -04:00
2013-04-16 23:59:59 -04:00
/**
* Effect : Unpin a brt node .
2013-04-16 23:59:59 -04:00
* Used for nodes pinned on a client thread
2013-04-16 23:59:59 -04:00
*/
2013-04-16 23:59:59 -04:00
void
2013-04-17 00:00:35 -04:00
toku_unpin_ftnode ( FT h , FTNODE node ) ;
2013-04-16 23:59:59 -04:00
2013-04-17 00:00:11 -04:00
void
2013-04-17 00:00:35 -04:00
toku_unpin_ftnode_read_only ( FT_HANDLE brt , FTNODE node ) ;
2013-04-17 00:00:11 -04:00
2013-04-16 23:59:59 -04:00
# endif