Some test utils

This commit is contained in:
Joe Thornber 2013-05-01 16:33:24 +01:00
parent 21603c5a5d
commit 647cb68b76
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,7 @@
#include "test_utils.h"
#include "persistent-data/space-maps/core.h"
//----------------------------------------------------------------
void test::zero_block(block_manager<>::ptr bm, block_address b)
@ -8,4 +10,11 @@ void test::zero_block(block_manager<>::ptr bm, block_address b)
memset(&wr.data(), 0, sizeof(wr.data()));
}
transaction_manager::ptr test::open_temporary_tm(block_manager<>::ptr bm)
{
space_map::ptr sm(new core_map(bm->get_nr_blocks()));
transaction_manager::ptr tm(new transaction_manager(bm, sm));
return tm;
}
//----------------------------------------------------------------

View File

@ -17,6 +17,7 @@
// <http://www.gnu.org/licenses/>.
#include "persistent-data/block.h"
#include "persistent-data/transaction_manager.h"
//----------------------------------------------------------------
@ -36,6 +37,9 @@ namespace test {
block_io<BlockSize>::CREATE));
}
// Don't use this to update the metadata.
transaction_manager::ptr open_temporary_tm(block_manager<>::ptr bm);
void zero_block(block_manager<>::ptr bm, block_address b);
}