Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60903 - in sandbox/transaction/boost/transact: . detail
From: strasser_at_[hidden]
Date: 2010-03-28 15:01:42


Author: stefans
Date: 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
New Revision: 60903
URL: http://svn.boost.org/trac/boost/changeset/60903

Log:
tabs -> spaces
Text files modified:
   sandbox/transaction/boost/transact/basic_transaction.hpp | 308 ++++++++--------
   sandbox/transaction/boost/transact/basic_transaction_manager.hpp | 730 ++++++++++++++++++++--------------------
   sandbox/transaction/boost/transact/detail/aligning_file.hpp | 166 ++++----
   sandbox/transaction/boost/transact/detail/buffering_file.hpp | 110 +++---
   sandbox/transaction/boost/transact/detail/embedded_vector.hpp | 420 +++++++++++-----------
   sandbox/transaction/boost/transact/detail/filebuf_file.hpp | 104 ++--
   sandbox/transaction/boost/transact/detail/mutex.hpp | 58 +-
   sandbox/transaction/boost/transact/detail/sectorizing_file.hpp | 248 ++++++------
   sandbox/transaction/boost/transact/detail/static_tss.hpp | 28
   sandbox/transaction/boost/transact/detail/syncing_file.hpp | 126 +++---
   sandbox/transaction/boost/transact/exception.hpp | 72 +-
   sandbox/transaction/boost/transact/log.hpp | 658 ++++++++++++++++++------------------
   sandbox/transaction/boost/transact/simple_transaction_manager.hpp | 206 +++++-----
   sandbox/transaction/boost/transact/transaction.hpp | 12
   14 files changed, 1623 insertions(+), 1623 deletions(-)

Modified: sandbox/transaction/boost/transact/basic_transaction.hpp
==============================================================================
--- sandbox/transaction/boost/transact/basic_transaction.hpp (original)
+++ sandbox/transaction/boost/transact/basic_transaction.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -24,112 +24,112 @@
 template<class TxMgr>
 class basic_transaction : noncopyable{
 public:
- /// Binds the new transaction to this thread.
- /// If there already is an active transaction, the new transaction will be a nested transaction
- /// of the active transaction.
- ///
- /// Throws: \c no_transaction_manager, \c io_failure, \c thread_resource_error,
- /// resource-specific exceptions
- /// thrown by resource managers beginning local transactions.
- /// \brief Constructs a basic_transaction, beginning a new transaction scope
- explicit basic_transaction()
- : parent(TxMgr::has_active_transaction() ? &TxMgr::active_transaction() : 0)
- , tx(TxMgr::begin_transaction())
- , done(false){
- TxMgr::bind_transaction(this->tx);
- }
-
- /// The transaction is rolled back if it is still active. Exceptions
- /// caused by rolling back the transaction are ignored.
- ///
- /// Throws: Nothing
- /// \brief Destructs the basic_transaction object
- ~basic_transaction(){
- if(!this->done){
- try{
- TxMgr::rollback_transaction(this->tx);
- }catch(...){
+ /// Binds the new transaction to this thread.
+ /// If there already is an active transaction, the new transaction will be a nested transaction
+ /// of the active transaction.
+ ///
+ /// Throws: \c no_transaction_manager, \c io_failure, \c thread_resource_error,
+ /// resource-specific exceptions
+ /// thrown by resource managers beginning local transactions.
+ /// \brief Constructs a basic_transaction, beginning a new transaction scope
+ explicit basic_transaction()
+ : parent(TxMgr::has_active_transaction() ? &TxMgr::active_transaction() : 0)
+ , tx(TxMgr::begin_transaction())
+ , done(false){
+ TxMgr::bind_transaction(this->tx);
+ }
+
+ /// The transaction is rolled back if it is still active. Exceptions
+ /// caused by rolling back the transaction are ignored.
+ ///
+ /// Throws: Nothing
+ /// \brief Destructs the basic_transaction object
+ ~basic_transaction(){
+ if(!this->done){
+ try{
+ TxMgr::rollback_transaction(this->tx);
+ }catch(...){
 #ifndef NDEBUG
- std::cerr << "ignored exception" << std::endl;
+ std::cerr << "ignored exception" << std::endl;
 #endif
- }
- }
- try{
- this->pop();
- }catch(...){
+ }
+ }
+ try{
+ this->pop();
+ }catch(...){
 #ifndef NDEBUG
- std::cerr << "ignored exception" << std::endl;
+ std::cerr << "ignored exception" << std::endl;
 #endif
- }
- }
+ }
+ }
 
- /// If this is a nested transaction, sets the active transaction to the parent transaction.
- /// If this is a root transaction, resets the active transaction.
- ///
- /// Throws: \c isolation_exception, \c io_failure, \c thread_resource_error,
- /// resource-specific exceptions thrown by resource managers committing local
- /// transactions.
- /// \brief Commits the transaction.
- void commit(){
- this->done=true;
- try{
- TxMgr::commit_transaction(this->tx);
- }catch(...){
- this->pop();
- throw;
- }
- }
- /// \cond
- void commit_(){
- this->commit();
- }
- /// \endcond
-
- /// If this is a nested transaction, sets the active transaction to the parent transaction.
- /// If this is a root transaction, resets the active transaction.
- ///
- /// Throws: \c io_failure, \c thread_resource_error, resource-specific exceptions
- /// thrown by resource managers rolling back transactions.
- /// \brief Unwinds all changes made during this transaction.
- void rollback(){
- this->done=true;
- try{
- TxMgr::rollback_transaction(this->tx);
- }catch(...){
- this->pop();
- throw;
- }
- this->pop();
- }
-
- /// Throws: thread_resource_error
- /// \brief Binds the current thread to this transaction
- void bind(){
- TxMgr::bind_transaction(this->tx);
- }
-
- /// Throws: thread_resource_error
- /// \brief If the current thread is bound to this transaction, unbinds it
- void unbind(){
- if(TxMgr::has_active_transaction() &&
- &TxMgr::active_transaction() == &this->tx){
- TxMgr::unbind_transaction();
- }
- }
+ /// If this is a nested transaction, sets the active transaction to the parent transaction.
+ /// If this is a root transaction, resets the active transaction.
+ ///
+ /// Throws: \c isolation_exception, \c io_failure, \c thread_resource_error,
+ /// resource-specific exceptions thrown by resource managers committing local
+ /// transactions.
+ /// \brief Commits the transaction.
+ void commit(){
+ this->done=true;
+ try{
+ TxMgr::commit_transaction(this->tx);
+ }catch(...){
+ this->pop();
+ throw;
+ }
+ }
+ /// \cond
+ void commit_(){
+ this->commit();
+ }
+ /// \endcond
+
+ /// If this is a nested transaction, sets the active transaction to the parent transaction.
+ /// If this is a root transaction, resets the active transaction.
+ ///
+ /// Throws: \c io_failure, \c thread_resource_error, resource-specific exceptions
+ /// thrown by resource managers rolling back transactions.
+ /// \brief Unwinds all changes made during this transaction.
+ void rollback(){
+ this->done=true;
+ try{
+ TxMgr::rollback_transaction(this->tx);
+ }catch(...){
+ this->pop();
+ throw;
+ }
+ this->pop();
+ }
+
+ /// Throws: thread_resource_error
+ /// \brief Binds the current thread to this transaction
+ void bind(){
+ TxMgr::bind_transaction(this->tx);
+ }
+
+ /// Throws: thread_resource_error
+ /// \brief If the current thread is bound to this transaction, unbinds it
+ void unbind(){
+ if(TxMgr::has_active_transaction() &&
+ &TxMgr::active_transaction() == &this->tx){
+ TxMgr::unbind_transaction();
+ }
+ }
 
     void restart(){}
 
- /// \cond
+ /// \cond
 private:
- void pop(){
- if(this->parent) TxMgr::bind_transaction(*this->parent);
- else TxMgr::unbind_transaction();
- }
-
- typename TxMgr::transaction *parent;
- typename TxMgr::transaction tx;
- bool done;
- /// \endcond
+ void pop(){
+ if(this->parent) TxMgr::bind_transaction(*this->parent);
+ else TxMgr::unbind_transaction();
+ }
+
+ typename TxMgr::transaction *parent;
+ typename TxMgr::transaction tx;
+ bool done;
+ /// \endcond
 };
 
 
@@ -137,16 +137,16 @@
 
 template<class TxMgr>
 struct commit_on_destruction{
- explicit commit_on_destruction(basic_transaction<TxMgr> &tx)
- : tx(&tx){}
- ~commit_on_destruction(){
- if(this->tx) this->tx->commit();
- }
- void nullify(){
- this->tx=0;
- }
+ explicit commit_on_destruction(basic_transaction<TxMgr> &tx)
+ : tx(&tx){}
+ ~commit_on_destruction(){
+ if(this->tx) this->tx->commit();
+ }
+ void nullify(){
+ this->tx=0;
+ }
 private:
- basic_transaction<TxMgr> *tx;
+ basic_transaction<TxMgr> *tx;
 };
 
 }
@@ -156,64 +156,64 @@
 
 
 #define BOOST_TRANSACT_BASIC_BEGIN_TRANSACTION(TXMGR) \
- { \
- int ___control; \
- boost::transact::basic_transaction<TXMGR> ___tx; \
- while(true){ \
- try{ \
- boost::transact::detail::commit_on_destruction<TXMGR> ___commit(___tx); \
- try{ \
- do{ \
- ___control=1; \
- if(false);else
+ { \
+ int ___control; \
+ boost::transact::basic_transaction<TXMGR> ___tx; \
+ while(true){ \
+ try{ \
+ boost::transact::detail::commit_on_destruction<TXMGR> ___commit(___tx); \
+ try{ \
+ do{ \
+ ___control=1; \
+ if(false);else
 
 #define BOOST_TRANSACT_BASIC_RETRY(TXMGR) \
- ___control=0; \
- break; \
- }while((___control=2),false); \
- }catch(...){ \
- ___commit.nullify(); \
- throw; \
- } \
- break; \
- }catch(boost::transact::isolation_exception &___i){ \
- ___i.unwind<TXMGR>(); \
- do{ \
- ___control=1; \
- if(false);else
+ ___control=0; \
+ break; \
+ }while((___control=2),false); \
+ }catch(...){ \
+ ___commit.nullify(); \
+ throw; \
+ } \
+ break; \
+ }catch(boost::transact::isolation_exception &___i){ \
+ ___i.unwind<TXMGR>(); \
+ do{ \
+ ___control=1; \
+ if(false);else
 
 #define BOOST_TRANSACT_BASIC_END_RETRY(TXMGR) \
- ___control=0; \
- break; \
- }while((___control=2),false); \
- } \
- BOOST_ASSERT(___control == 0); \
- ___tx.restart(); \
- }; \
- BOOST_ASSERT(___control == 0); \
- }void()
+ ___control=0; \
+ break; \
+ }while((___control=2),false); \
+ } \
+ BOOST_ASSERT(___control == 0); \
+ ___tx.restart(); \
+ }; \
+ BOOST_ASSERT(___control == 0); \
+ }void()
 
 #define BOOST_TRANSACT_BASIC_END_RETRY_IN_LOOP(TXMGR) \
- ___control=0; \
- break; \
- }while((___control=2),false); \
- } \
- if(___control != 0) break; \
- ___tx.restart(); \
- }; \
- if(___control != 0){ \
- if(___control==1) break; \
- else continue; \
- } \
- }void()
+ ___control=0; \
+ break; \
+ }while((___control=2),false); \
+ } \
+ if(___control != 0) break; \
+ ___tx.restart(); \
+ }; \
+ if(___control != 0){ \
+ if(___control==1) break; \
+ else continue; \
+ } \
+ }void()
 
 #define BOOST_TRANSACT_BASIC_END_TRANSACTION(TXMGR) \
- BOOST_TRANSACT_BASIC_RETRY(TXMGR){} \
- BOOST_TRANSACT_BASIC_END_RETRY(TXMGR)
+ BOOST_TRANSACT_BASIC_RETRY(TXMGR){} \
+ BOOST_TRANSACT_BASIC_END_RETRY(TXMGR)
 
 #define BOOST_TRANSACT_BASIC_END_TRANSACTION_IN_LOOP(TXMGR) \
- BOOST_TRANSACT_BASIC_RETRY(TXMGR){} \
- BOOST_TRANSACT_BASIC_END_RETRY_IN_LOOP(TXMGR)
+ BOOST_TRANSACT_BASIC_RETRY(TXMGR){} \
+ BOOST_TRANSACT_BASIC_END_RETRY_IN_LOOP(TXMGR)
 
 
 

Modified: sandbox/transaction/boost/transact/basic_transaction_manager.hpp
==============================================================================
--- sandbox/transaction/boost/transact/basic_transaction_manager.hpp (original)
+++ sandbox/transaction/boost/transact/basic_transaction_manager.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -52,34 +52,34 @@
 
 template<class Resource>
 struct get_tag{
- typedef typename Resource::tag type;
+ typedef typename Resource::tag type;
 };
 template<class Resources>
 struct default_lazy_resources{
- typedef typename mpl::if_c<
- mpl::size<Resources>::value==1,
- mpl::empty_sequence,
- typename mpl::transform<Resources,get_tag<mpl::_1> >::type
- >::type type;
+ typedef typename mpl::if_c<
+ mpl::size<Resources>::value==1,
+ mpl::empty_sequence,
+ typename mpl::transform<Resources,get_tag<mpl::_1> >::type
+ >::type type;
 };
 
 template<class State,class F>
 struct runtime_folder{
- explicit runtime_folder(State &state,F &f)
- : state(state),f(f){}
- template<class U>
- void operator()(U x){
- state=f(state,x);
- }
+ explicit runtime_folder(State &state,F &f)
+ : state(state),f(f){}
+ template<class U>
+ void operator()(U x){
+ state=f(state,x);
+ }
 private:
- State &state;
- F &f;
+ State &state;
+ F &f;
 };
 
 template<class Sequence,class State,class F>
 State runtime_fold(State state,F f){
- mpl::for_each<Sequence>(runtime_folder<State,F>(state,f));
- return state;
+ mpl::for_each<Sequence>(runtime_folder<State,F>(state,f));
+ return state;
 }
 
 }
@@ -100,363 +100,363 @@
 /// are started lazily, unless there is only one resource manager used.
 /// \brief A transaction manager
 template<
- class Resources,
- bool Threads=true,
- bool TThreads=true,
- class Lazy=typename detail::default_lazy_resources<Resources>::type
+ class Resources,
+ bool Threads=true,
+ bool TThreads=true,
+ class Lazy=typename detail::default_lazy_resources<Resources>::type
>
 class basic_transaction_manager : noncopyable{
 /// \cond
- BOOST_STATIC_ASSERT(Threads || !TThreads);
+ BOOST_STATIC_ASSERT(Threads || !TThreads);
 private:
- struct detail{
- typedef typename mpl::transform<
- Resources,
- transact::detail::get_tag<mpl::_1>
- >::type resource_tags;
-
- template<class Resource>
- struct make_resource_pair{
- typedef mpl::pair<typename Resource::tag,Resource> type;
- };
- typedef typename mpl::fold<
- Resources,
- mpl::map0<>,
- mpl::insert<mpl::_1,make_resource_pair<mpl::_2> >
- >::type resource_types_by_tag;
-
- template<class Tag>
- struct resource_type{
- typedef typename mpl::at<resource_types_by_tag,Tag>::type type;
- };
-
- template<class Resource>
- struct get_services{
- typedef typename Resource::services type;
- };
- template<class Service>
- struct default_resource{
- typedef typename mpl::deref<
- typename mpl::find_if<
- Resources,
- mpl::contains<get_services<mpl::_1>,Service>
- >::type
- >::type::tag type;
- };
-
- class transaction;
- class transaction_construct_t{
- explicit transaction_construct_t(transaction *parent)
- : parent(parent){}
- friend class basic_transaction_manager;
- transaction *parent;
- };
-
- class transaction : noncopyable{
- public:
- explicit transaction(transaction_construct_t const &c) : parent(c.parent){
- mpl::for_each<resource_tags>(beginner(*this));
- }
- private:
- friend class basic_transaction_manager;
-
- template<class Resource>
- struct make_resource_transaction_pair{
- typedef fusion::pair<typename Resource::tag,optional<typename Resource::transaction> > type;
- };
- typedef typename fusion::result_of::as_map<
- typename mpl::transform<
- Resources,
- make_resource_transaction_pair<mpl::_1>
- >::type
- >::type resource_transactions_type;
- resource_transactions_type resource_transactions;
-
- transaction * const parent;
-
- typedef typename mpl::if_c<
- TThreads,
- transact::detail::mutex_type,
- transact::detail::null_lockable
- >::type mutex_type;
-
- mutex_type mutex;
- };
- };
- struct activetx_tag{};
- typedef transact::detail::static_thread_specific_ptr<
- typename detail::transaction,
- activetx_tag,
- Threads> activetx;
- /// \endcond
+ struct detail{
+ typedef typename mpl::transform<
+ Resources,
+ transact::detail::get_tag<mpl::_1>
+ >::type resource_tags;
+
+ template<class Resource>
+ struct make_resource_pair{
+ typedef mpl::pair<typename Resource::tag,Resource> type;
+ };
+ typedef typename mpl::fold<
+ Resources,
+ mpl::map0<>,
+ mpl::insert<mpl::_1,make_resource_pair<mpl::_2> >
+ >::type resource_types_by_tag;
+
+ template<class Tag>
+ struct resource_type{
+ typedef typename mpl::at<resource_types_by_tag,Tag>::type type;
+ };
+
+ template<class Resource>
+ struct get_services{
+ typedef typename Resource::services type;
+ };
+ template<class Service>
+ struct default_resource{
+ typedef typename mpl::deref<
+ typename mpl::find_if<
+ Resources,
+ mpl::contains<get_services<mpl::_1>,Service>
+ >::type
+ >::type::tag type;
+ };
+
+ class transaction;
+ class transaction_construct_t{
+ explicit transaction_construct_t(transaction *parent)
+ : parent(parent){}
+ friend class basic_transaction_manager;
+ transaction *parent;
+ };
+
+ class transaction : noncopyable{
+ public:
+ explicit transaction(transaction_construct_t const &c) : parent(c.parent){
+ mpl::for_each<resource_tags>(beginner(*this));
+ }
+ private:
+ friend class basic_transaction_manager;
+
+ template<class Resource>
+ struct make_resource_transaction_pair{
+ typedef fusion::pair<typename Resource::tag,optional<typename Resource::transaction> > type;
+ };
+ typedef typename fusion::result_of::as_map<
+ typename mpl::transform<
+ Resources,
+ make_resource_transaction_pair<mpl::_1>
+ >::type
+ >::type resource_transactions_type;
+ resource_transactions_type resource_transactions;
+
+ transaction * const parent;
+
+ typedef typename mpl::if_c<
+ TThreads,
+ transact::detail::mutex_type,
+ transact::detail::null_lockable
+ >::type mutex_type;
+
+ mutex_type mutex;
+ };
+ };
+ struct activetx_tag{};
+ typedef transact::detail::static_thread_specific_ptr<
+ typename detail::transaction,
+ activetx_tag,
+ Threads> activetx;
+ /// \endcond
 public:
- typedef typename detail::transaction transaction;
- typedef Resources resource_types;
- template<class ServiceTag>
- struct default_resource{
- typedef typename detail::template default_resource<ServiceTag>::type type;
- };
-
- /// A basic_transaction_manager constructed using this constructor
- /// is not able to commit transactions that involve two or more persistent
- /// resource managers, i.e. that require a two phase commit protocol.
- /// \brief Constructs a basic_transaction_manager
- basic_transaction_manager(){}
-
- /// TODO doc, not part of the concept
- template<class Resource>
- static void connect_resource(Resource &newres){
- Resource *&res=fusion::at_key<typename Resource::tag>(resources);
- if(res) throw resource_error();
- res=&newres;
- }
-
- /// TODO doc, not part of the concept
- template<class ResourceTag>
- static void disconnect_resource(ResourceTag tag=ResourceTag()){
- fusion::at<ResourceTag>(resources)=0;
- }
-
- template<class Tag>
- static typename detail::resource_type<Tag>::type &resource(Tag tag=Tag()){
- typename detail::resource_type<Tag>::type *res
- =fusion::at_key<Tag>(resources);
- if(res) return *res;
- else throw resource_error();
- }
-
- template<class Tag>
- static typename detail::resource_type<Tag>::type::transaction &
- resource_transaction(transaction &tx,Tag tag=Tag()){
- return resource_transaction(tx,tag,typename mpl::contains<Lazy,Tag>());
- }
-
- static typename detail::transaction_construct_t begin_transaction(){
- return typename detail::transaction_construct_t(activetx::get());
- }
-
- static void commit_transaction(transaction &tx){
- typedef typename detail::resource_tags tags;
- bind_transaction(tx);
-
- //call finish_transaction until all transactions return false
- while(transact::detail::runtime_fold<tags>(false,finisher(tx)));
-
- mpl::for_each<tags>(preparer<false>(tx)); //prepare transient two-phase transactions
- //count persistent transactions and transactions that only support one-phase commit:
- std::size_t pers=transact::detail::runtime_fold<tags>(0,persistent_counter(tx));
- if(pers > 1){
- mpl::for_each<tags>(preparer<true>(tx)); //prepare persistent transactions
- //TODO write commit message to log
- mpl::for_each<tags>(committer<true>(tx)); //commit persistent transactions
- }else{
- mpl::for_each<tags>(committer<true>(tx)); //commit persistent transaction unprepared
- }
- mpl::for_each<tags>(committer<false>(tx)); //commit transient two-phase transactions
- }
-
- static void rollback_transaction(transaction &tx){
- bind_transaction(tx);
- mpl::for_each<detail::resource_tags>(rollbacker(tx));
- }
-
- static void bind_transaction(transaction &tx){
- activetx::reset(&tx);
- }
- static void unbind_transaction(){
- activetx::reset(0);
- }
-
- static transaction &active_transaction(){
- if(transaction *tx=activetx::get()) return *tx;
- else throw no_active_transaction();
- }
- static bool has_active_transaction(){
- return activetx::get() ? true : false;
- }
+ typedef typename detail::transaction transaction;
+ typedef Resources resource_types;
+ template<class ServiceTag>
+ struct default_resource{
+ typedef typename detail::template default_resource<ServiceTag>::type type;
+ };
+
+ /// A basic_transaction_manager constructed using this constructor
+ /// is not able to commit transactions that involve two or more persistent
+ /// resource managers, i.e. that require a two phase commit protocol.
+ /// \brief Constructs a basic_transaction_manager
+ basic_transaction_manager(){}
+
+ /// TODO doc, not part of the concept
+ template<class Resource>
+ static void connect_resource(Resource &newres){
+ Resource *&res=fusion::at_key<typename Resource::tag>(resources);
+ if(res) throw resource_error();
+ res=&newres;
+ }
+
+ /// TODO doc, not part of the concept
+ template<class ResourceTag>
+ static void disconnect_resource(ResourceTag tag=ResourceTag()){
+ fusion::at<ResourceTag>(resources)=0;
+ }
+
+ template<class Tag>
+ static typename detail::resource_type<Tag>::type &resource(Tag tag=Tag()){
+ typename detail::resource_type<Tag>::type *res
+ =fusion::at_key<Tag>(resources);
+ if(res) return *res;
+ else throw resource_error();
+ }
+
+ template<class Tag>
+ static typename detail::resource_type<Tag>::type::transaction &
+ resource_transaction(transaction &tx,Tag tag=Tag()){
+ return resource_transaction(tx,tag,typename mpl::contains<Lazy,Tag>());
+ }
+
+ static typename detail::transaction_construct_t begin_transaction(){
+ return typename detail::transaction_construct_t(activetx::get());
+ }
+
+ static void commit_transaction(transaction &tx){
+ typedef typename detail::resource_tags tags;
+ bind_transaction(tx);
+
+ //call finish_transaction until all transactions return false
+ while(transact::detail::runtime_fold<tags>(false,finisher(tx)));
+
+ mpl::for_each<tags>(preparer<false>(tx)); //prepare transient two-phase transactions
+ //count persistent transactions and transactions that only support one-phase commit:
+ std::size_t pers=transact::detail::runtime_fold<tags>(0,persistent_counter(tx));
+ if(pers > 1){
+ mpl::for_each<tags>(preparer<true>(tx)); //prepare persistent transactions
+ //TODO write commit message to log
+ mpl::for_each<tags>(committer<true>(tx)); //commit persistent transactions
+ }else{
+ mpl::for_each<tags>(committer<true>(tx)); //commit persistent transaction unprepared
+ }
+ mpl::for_each<tags>(committer<false>(tx)); //commit transient two-phase transactions
+ }
+
+ static void rollback_transaction(transaction &tx){
+ bind_transaction(tx);
+ mpl::for_each<detail::resource_tags>(rollbacker(tx));
+ }
+
+ static void bind_transaction(transaction &tx){
+ activetx::reset(&tx);
+ }
+ static void unbind_transaction(){
+ activetx::reset(0);
+ }
+
+ static transaction &active_transaction(){
+ if(transaction *tx=activetx::get()) return *tx;
+ else throw no_active_transaction();
+ }
+ static bool has_active_transaction(){
+ return activetx::get() ? true : false;
+ }
 
- /// \cond
+ /// \cond
 private:
- struct persistent_counter{
- explicit persistent_counter(transaction &tx) : tx(tx){}
- template<class Tag>
- std::size_t operator()(std::size_t c,Tag){
- typedef typename detail::resource_type<Tag>::type res_type;
- if(is_persistent<res_type>::type::value){
- if(fusion::at_key<Tag>(tx.resource_transactions)){
- return c+1;
- }
- }
- return c;
- }
- private:
- transaction &tx;
- };
- struct finisher{
- explicit finisher(transaction &tx) : tx(tx){}
- template<class Tag>
- bool operator()(bool repeat,Tag tag){
- typedef typename detail::resource_type<Tag>::type res_type;
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
- if(rtx){
- res_type *rmgr=fusion::at_key<Tag>(resources);
- BOOST_ASSERT(rmgr);
- return rmgr->finish_transaction(*rtx) || repeat;
- }
- return repeat;
- }
- private:
- transaction &tx;
- };
- struct beginner{
- explicit beginner(transaction &tx) : tx(tx){}
- template<class Tag>
- void operator()(Tag tag){
- this->begin(tag,typename mpl::contains<Lazy,Tag>::type());
- }
- private:
- template<class Tag>
- void begin(Tag,mpl::true_ lazy){}
- template<class Tag>
- void begin(Tag,mpl::false_ lazy){
- typedef typename detail::resource_type<Tag>::type res_type;
- res_type *rmgr=fusion::at_key<Tag>(resources);
- if(rmgr){
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
- BOOST_ASSERT(!rtx);
- if(tx.parent){
- typename res_type::transaction &parentrtx=
- resource_transaction<Tag>(*tx.parent);
- rtx=in_place(rmgr->begin_nested_transaction(parentrtx));
- }else rtx=in_place(rmgr->begin_root_transaction());
- }
- }
- transaction &tx;
- };
- template<class Tag>
- static typename detail::resource_type<Tag>::type::transaction &
- resource_transaction(transaction &tx,Tag tag,mpl::true_ lazy){
- typedef typename detail::resource_type<Tag>::type res_type;
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
-
- lock_guard<typename transaction::mutex_type> l(tx.mutex);
- if(!rtx){
- res_type &res=resource(tag);
- if(tx.parent){
- //TODO optimization: if 10 nested transactions were created in one resource manager,
- //and then a second resource manager is called for the first time in the innermost
- //transaction, 10 nested transactions are created in the second resource manager,
- //even though it would be enough to create one transaction
- //that gets committed only when the outermost global transaction is committed.
- //(or is moved to the parent on commit instead of performing an actual commit?)
-
- typename res_type::transaction &parentrtx=resource_transaction<Tag>(*tx.parent);
- rtx=in_place(res.begin_nested_transaction(parentrtx));
- }else{
- rtx=in_place(res.begin_root_transaction());
- }
- }
- return *rtx;
- }
- template<class Tag>
- static typename detail::resource_type<Tag>::type::transaction &
- resource_transaction(transaction &tx,Tag tag,mpl::false_ lazy){
- typedef typename detail::resource_type<Tag>::type res_type;
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
- BOOST_ASSERT(rtx);
- return *rtx;
- }
- template<class Resource>
- struct is_persistent{
- typedef mpl::true_ type; //FIXME
- };
- template<class Resource>
- struct is_two_phase{
- typedef mpl::false_ type; //FIXME
- };
-
- template<bool Persistent>
- struct committer{
- explicit committer(transaction &tx) : tx(tx){}
- template<class Tag>
- void operator()(Tag){
- typedef typename detail::resource_type<Tag>::type res_type;
- if(Persistent == is_persistent<res_type>::type::value){
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
- if(rtx){
- res_type *res=fusion::at_key<Tag>(resources);
- BOOST_ASSERT(res);
- res->commit_transaction(*rtx);
- }
- }
- }
- private:
- transaction &tx;
- };
- template<bool Persistent>
- struct preparer{
- explicit preparer(transaction &tx) : tx(tx){}
- template<class Tag>
- void operator()(Tag){
- typedef typename detail::resource_type<Tag>::type res_type;
- if(Persistent == is_persistent<res_type>::type::value){
- typedef typename detail::resource_type<Tag>::type res_type;
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
- if(rtx){
- res_type *res=fusion::at_key<Tag>(resources);
- BOOST_ASSERT(res);
- this->prepare(*res,*rtx,typename is_two_phase<res_type>::type());
- }
- }
- }
- private:
- template<class Resource>
- void prepare(Resource &res,typename Resource::transaction &rtx,mpl::true_){
- res.prepare_transaction(rtx);
- }
- template<class Resource>
- void prepare(Resource &res,typename Resource::transaction &rtx,mpl::false_){
- //a resource that does not support two-phase-commit was used
- //together with other persistent resources
- throw unsupported_operation();
- }
- transaction &tx;
- };
- struct rollbacker{
- explicit rollbacker(transaction &tx) : tx(tx){}
- template<class Tag>
- void operator()(Tag){
- typedef typename detail::resource_type<Tag>::type res_type;
- optional<typename res_type::transaction> &rtx=
- fusion::at_key<Tag>(tx.resource_transactions);
- if(rtx){
- res_type *res=fusion::at_key<Tag>(resources);
- BOOST_ASSERT(res);
- res->rollback_transaction(*rtx);
- }
- }
- private:
- transaction &tx;
- };
- template<class Resource>
- struct make_resource_ptr_pair{
- typedef fusion::pair<typename Resource::tag,Resource *> type;
- };
- typedef typename fusion::result_of::as_map<
- typename mpl::transform<
- Resources,
- make_resource_ptr_pair<mpl::_1>
- >::type
- >::type resources_type;
- static resources_type resources;
+ struct persistent_counter{
+ explicit persistent_counter(transaction &tx) : tx(tx){}
+ template<class Tag>
+ std::size_t operator()(std::size_t c,Tag){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ if(is_persistent<res_type>::type::value){
+ if(fusion::at_key<Tag>(tx.resource_transactions)){
+ return c+1;
+ }
+ }
+ return c;
+ }
+ private:
+ transaction &tx;
+ };
+ struct finisher{
+ explicit finisher(transaction &tx) : tx(tx){}
+ template<class Tag>
+ bool operator()(bool repeat,Tag tag){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+ if(rtx){
+ res_type *rmgr=fusion::at_key<Tag>(resources);
+ BOOST_ASSERT(rmgr);
+ return rmgr->finish_transaction(*rtx) || repeat;
+ }
+ return repeat;
+ }
+ private:
+ transaction &tx;
+ };
+ struct beginner{
+ explicit beginner(transaction &tx) : tx(tx){}
+ template<class Tag>
+ void operator()(Tag tag){
+ this->begin(tag,typename mpl::contains<Lazy,Tag>::type());
+ }
+ private:
+ template<class Tag>
+ void begin(Tag,mpl::true_ lazy){}
+ template<class Tag>
+ void begin(Tag,mpl::false_ lazy){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ res_type *rmgr=fusion::at_key<Tag>(resources);
+ if(rmgr){
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+ BOOST_ASSERT(!rtx);
+ if(tx.parent){
+ typename res_type::transaction &parentrtx=
+ resource_transaction<Tag>(*tx.parent);
+ rtx=in_place(rmgr->begin_nested_transaction(parentrtx));
+ }else rtx=in_place(rmgr->begin_root_transaction());
+ }
+ }
+ transaction &tx;
+ };
+ template<class Tag>
+ static typename detail::resource_type<Tag>::type::transaction &
+ resource_transaction(transaction &tx,Tag tag,mpl::true_ lazy){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+
+ lock_guard<typename transaction::mutex_type> l(tx.mutex);
+ if(!rtx){
+ res_type &res=resource(tag);
+ if(tx.parent){
+ //TODO optimization: if 10 nested transactions were created in one resource manager,
+ //and then a second resource manager is called for the first time in the innermost
+ //transaction, 10 nested transactions are created in the second resource manager,
+ //even though it would be enough to create one transaction
+ //that gets committed only when the outermost global transaction is committed.
+ //(or is moved to the parent on commit instead of performing an actual commit?)
+
+ typename res_type::transaction &parentrtx=resource_transaction<Tag>(*tx.parent);
+ rtx=in_place(res.begin_nested_transaction(parentrtx));
+ }else{
+ rtx=in_place(res.begin_root_transaction());
+ }
+ }
+ return *rtx;
+ }
+ template<class Tag>
+ static typename detail::resource_type<Tag>::type::transaction &
+ resource_transaction(transaction &tx,Tag tag,mpl::false_ lazy){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+ BOOST_ASSERT(rtx);
+ return *rtx;
+ }
+ template<class Resource>
+ struct is_persistent{
+ typedef mpl::true_ type; //FIXME
+ };
+ template<class Resource>
+ struct is_two_phase{
+ typedef mpl::false_ type; //FIXME
+ };
+
+ template<bool Persistent>
+ struct committer{
+ explicit committer(transaction &tx) : tx(tx){}
+ template<class Tag>
+ void operator()(Tag){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ if(Persistent == is_persistent<res_type>::type::value){
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+ if(rtx){
+ res_type *res=fusion::at_key<Tag>(resources);
+ BOOST_ASSERT(res);
+ res->commit_transaction(*rtx);
+ }
+ }
+ }
+ private:
+ transaction &tx;
+ };
+ template<bool Persistent>
+ struct preparer{
+ explicit preparer(transaction &tx) : tx(tx){}
+ template<class Tag>
+ void operator()(Tag){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ if(Persistent == is_persistent<res_type>::type::value){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+ if(rtx){
+ res_type *res=fusion::at_key<Tag>(resources);
+ BOOST_ASSERT(res);
+ this->prepare(*res,*rtx,typename is_two_phase<res_type>::type());
+ }
+ }
+ }
+ private:
+ template<class Resource>
+ void prepare(Resource &res,typename Resource::transaction &rtx,mpl::true_){
+ res.prepare_transaction(rtx);
+ }
+ template<class Resource>
+ void prepare(Resource &res,typename Resource::transaction &rtx,mpl::false_){
+ //a resource that does not support two-phase-commit was used
+ //together with other persistent resources
+ throw unsupported_operation();
+ }
+ transaction &tx;
+ };
+ struct rollbacker{
+ explicit rollbacker(transaction &tx) : tx(tx){}
+ template<class Tag>
+ void operator()(Tag){
+ typedef typename detail::resource_type<Tag>::type res_type;
+ optional<typename res_type::transaction> &rtx=
+ fusion::at_key<Tag>(tx.resource_transactions);
+ if(rtx){
+ res_type *res=fusion::at_key<Tag>(resources);
+ BOOST_ASSERT(res);
+ res->rollback_transaction(*rtx);
+ }
+ }
+ private:
+ transaction &tx;
+ };
+ template<class Resource>
+ struct make_resource_ptr_pair{
+ typedef fusion::pair<typename Resource::tag,Resource *> type;
+ };
+ typedef typename fusion::result_of::as_map<
+ typename mpl::transform<
+ Resources,
+ make_resource_ptr_pair<mpl::_1>
+ >::type
+ >::type resources_type;
+ static resources_type resources;
 
- /// \endcond
+ /// \endcond
 };
 
 template<class Res,bool Thr,bool TThr,class Lazy>

Modified: sandbox/transaction/boost/transact/detail/aligning_file.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/aligning_file.hpp (original)
+++ sandbox/transaction/boost/transact/detail/aligning_file.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -32,94 +32,94 @@
 template<class Base>
 class aligning_seq_ofile{
 public:
- typedef typename Base::size_type size_type;
+ typedef typename Base::size_type size_type;
 private:
- static std::size_t const sector_size=512;
- static std::size_t const max_alignment=4096;
- static std::size_t const max_sectors=max_alignment / sector_size / 2;
+ static std::size_t const sector_size=512;
+ static std::size_t const max_alignment=4096;
+ static std::size_t const max_sectors=max_alignment / sector_size / 2;
 public:
- explicit aligning_seq_ofile(std::string const &name)
- : base(name)
- , sectors(0){}
- void save_binary(void const *data,mpl::size_t<sector_size> size){
- if(this->sectors < max_sectors){
- std::memcpy(this->buffer + this->sectors * sector_size,data,size);
- ++this->sectors;
- }else this->save_overflow(data);
- }
- size_type position() const{
- if(this->sectors <= max_sectors) return this->base.position() + this->sectors * sector_size;
- else return this->base.position();
- }
- void flush(){
- BOOST_ASSERT(this->base.position() % sector_size == 0);
- if(this->sectors > 1 && this->sectors <= max_sectors){
- BOOST_STATIC_ASSERT(max_sectors == 4);
- this->align((this->sectors == 3 ? 4 : this->sectors) * sector_size);
- }
- this->flush_buffer();
- this->sectors=0;
- this->base.flush();
- }
- void sync(){
- this->base.sync();
- }
- ~aligning_seq_ofile(){
- try{
- this->flush_buffer();
- }catch(...){
+ explicit aligning_seq_ofile(std::string const &name)
+ : base(name)
+ , sectors(0){}
+ void save_binary(void const *data,mpl::size_t<sector_size> size){
+ if(this->sectors < max_sectors){
+ std::memcpy(this->buffer + this->sectors * sector_size,data,size);
+ ++this->sectors;
+ }else this->save_overflow(data);
+ }
+ size_type position() const{
+ if(this->sectors <= max_sectors) return this->base.position() + this->sectors * sector_size;
+ else return this->base.position();
+ }
+ void flush(){
+ BOOST_ASSERT(this->base.position() % sector_size == 0);
+ if(this->sectors > 1 && this->sectors <= max_sectors){
+ BOOST_STATIC_ASSERT(max_sectors == 4);
+ this->align((this->sectors == 3 ? 4 : this->sectors) * sector_size);
+ }
+ this->flush_buffer();
+ this->sectors=0;
+ this->base.flush();
+ }
+ void sync(){
+ this->base.sync();
+ }
+ ~aligning_seq_ofile(){
+ try{
+ this->flush_buffer();
+ }catch(...){
 #ifndef NDEBUG
- std::cerr << "ignored exception" << std::endl;
+ std::cerr << "ignored exception" << std::endl;
 #endif
- }
- }
+ }
+ }
 private:
- void save_overflow(void const *data){
- BOOST_ASSERT(this->sectors >= max_sectors);
- if(this->sectors == max_sectors){
- this->align(max_alignment);
- this->flush_buffer();
- this->sectors=max_sectors+1;
- }
- this->base.save_binary(data,sector_size);
- }
-
- void flush_buffer(){
- if(this->sectors > 0 && this->sectors <= max_sectors){
- this->base.save_binary(this->buffer,this->sectors * sector_size);
- }
- }
- void align(std::size_t alignment){
- BOOST_ASSERT(this->base.position() % sector_size == 0);
- std::size_t mod=this->base.position() % alignment;
- if(mod != 0){
- std::size_t write=alignment - mod;
- BOOST_ASSERT(write <= empty_sectors_t::size && write % sector_size == 0);
- this->base.save_binary(empty_sectors.data,write);
- this->base.flush();
- //this sync is unnecessary from a data-consistency viewpoint.
- //but it is required to keep linux is sequential writing.
- this->base.sync(); //TODO optimization: sync inside mutex lock
- }
- }
-
- Base base;
- unsigned char buffer[max_sectors * sector_size];
- std::size_t sectors;
-
- struct empty_sectors_t{
- empty_sectors_t(){
- for(std::size_t c=0;c<sectors;++c) clear_sector(this->data + c*sector_size);
- }
- static std::size_t const size=max_alignment - sector_size;
- static std::size_t const sectors = size / sector_size;
- unsigned char data[size];
- static void clear_sector(char *sec){
- sec[0]=0x80;
- sec[sector_size-1]=0x80;
- }
- };
- static empty_sectors_t empty_sectors;
+ void save_overflow(void const *data){
+ BOOST_ASSERT(this->sectors >= max_sectors);
+ if(this->sectors == max_sectors){
+ this->align(max_alignment);
+ this->flush_buffer();
+ this->sectors=max_sectors+1;
+ }
+ this->base.save_binary(data,sector_size);
+ }
+
+ void flush_buffer(){
+ if(this->sectors > 0 && this->sectors <= max_sectors){
+ this->base.save_binary(this->buffer,this->sectors * sector_size);
+ }
+ }
+ void align(std::size_t alignment){
+ BOOST_ASSERT(this->base.position() % sector_size == 0);
+ std::size_t mod=this->base.position() % alignment;
+ if(mod != 0){
+ std::size_t write=alignment - mod;
+ BOOST_ASSERT(write <= empty_sectors_t::size && write % sector_size == 0);
+ this->base.save_binary(empty_sectors.data,write);
+ this->base.flush();
+ //this sync is unnecessary from a data-consistency viewpoint.
+ //but it is required to keep linux is sequential writing.
+ this->base.sync(); //TODO optimization: sync inside mutex lock
+ }
+ }
+
+ Base base;
+ unsigned char buffer[max_sectors * sector_size];
+ std::size_t sectors;
+
+ struct empty_sectors_t{
+ empty_sectors_t(){
+ for(std::size_t c=0;c<sectors;++c) clear_sector(this->data + c*sector_size);
+ }
+ static std::size_t const size=max_alignment - sector_size;
+ static std::size_t const sectors = size / sector_size;
+ unsigned char data[size];
+ static void clear_sector(char *sec){
+ sec[0]=0x80;
+ sec[sector_size-1]=0x80;
+ }
+ };
+ static empty_sectors_t empty_sectors;
 };
 
 template<class Base>

Modified: sandbox/transaction/boost/transact/detail/buffering_file.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/buffering_file.hpp (original)
+++ sandbox/transaction/boost/transact/detail/buffering_file.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -19,64 +19,64 @@
 template<class Base,std::size_t Capacity>
 class buffering_seq_ofile{
 public:
- typedef typename Base::size_type size_type;
- explicit buffering_seq_ofile(std::string const &name)
- : base(name)
- , size(0){}
- template<class Size>
- void save_binary(void const *data,Size s){
- if(this->size + s <= Capacity){
- std::memcpy(this->buffer+this->size,data,s);
- this->size+=s;
- }else this->save_overflow(data,s);
- }
- template<class T>
- void save(T const &t){
- this->save_binary(&t,mpl::size_t<sizeof(T)>());
- }
- size_type position() const{
- return this->base.position() + this->size;
- }
- void flush(){
- this->flush_buffer();
- this->base.flush();
- }
- void sync(){
- //don't flush buffer! caller is responsible to call flush() inside a mutex lock.
- this->base.sync();
- }
- ~buffering_seq_ofile(){
- try{
- this->flush_buffer();
- }catch(...){
+ typedef typename Base::size_type size_type;
+ explicit buffering_seq_ofile(std::string const &name)
+ : base(name)
+ , size(0){}
+ template<class Size>
+ void save_binary(void const *data,Size s){
+ if(this->size + s <= Capacity){
+ std::memcpy(this->buffer+this->size,data,s);
+ this->size+=s;
+ }else this->save_overflow(data,s);
+ }
+ template<class T>
+ void save(T const &t){
+ this->save_binary(&t,mpl::size_t<sizeof(T)>());
+ }
+ size_type position() const{
+ return this->base.position() + this->size;
+ }
+ void flush(){
+ this->flush_buffer();
+ this->base.flush();
+ }
+ void sync(){
+ //don't flush buffer! caller is responsible to call flush() inside a mutex lock.
+ this->base.sync();
+ }
+ ~buffering_seq_ofile(){
+ try{
+ this->flush_buffer();
+ }catch(...){
 #ifndef NDEBUG
- std::cerr << "ignored exception" << std::endl;
+ std::cerr << "ignored exception" << std::endl;
 #endif
- }
- }
+ }
+ }
 private:
- void save_overflow(void const *data,std::size_t s){
- BOOST_ASSERT(this->size + s > Capacity);
- if(this->size == 0){
- this->base.save_binary(data,s);
- }else{
- std::size_t write=Capacity - this->size;
- std::memcpy(this->buffer+this->size,data,write);
- this->size=Capacity;
- this->flush_buffer();
- this->save_binary(static_cast<char const *>(data)+write,s-write);
- }
- }
- void flush_buffer(){
- if(this->size > 0){
- this->base.save_binary(this->buffer,this->size);
- this->size=0;
- }
- }
-
- Base base;
- char buffer[Capacity];
- std::size_t size;
+ void save_overflow(void const *data,std::size_t s){
+ BOOST_ASSERT(this->size + s > Capacity);
+ if(this->size == 0){
+ this->base.save_binary(data,s);
+ }else{
+ std::size_t write=Capacity - this->size;
+ std::memcpy(this->buffer+this->size,data,write);
+ this->size=Capacity;
+ this->flush_buffer();
+ this->save_binary(static_cast<char const *>(data)+write,s-write);
+ }
+ }
+ void flush_buffer(){
+ if(this->size > 0){
+ this->base.save_binary(this->buffer,this->size);
+ this->size=0;
+ }
+ }
+
+ Base base;
+ char buffer[Capacity];
+ std::size_t size;
 };
 
 

Modified: sandbox/transaction/boost/transact/detail/embedded_vector.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/embedded_vector.hpp (original)
+++ sandbox/transaction/boost/transact/detail/embedded_vector.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -14,220 +14,220 @@
 template<class T,std::size_t EmbeddedSize,bool Expand=true>
 class embedded_vector{
 public:
- typedef T &reference;
- typedef T const &const_reference;
- typedef T *iterator;
- typedef T const *const_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef T value_type;
- typedef T *pointer;
- typedef T const *const_pointer;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- embedded_vector()
- : begin_(emb_data())
- , end_(emb_data())
- , end_storage(emb_data() + EmbeddedSize){}
-
- embedded_vector(size_type n,T const &value=T());
- template<class InputIterator>
- embedded_vector(InputIterator begin,InputIterator end);
- embedded_vector(embedded_vector const &);
- ~embedded_vector(){
- destruct(this->begin(),this->end());
- if(Expand){
- if(this->begin() != this->emb_data()){
- ::operator delete(this->begin_);
- }
- }else BOOST_ASSERT(this->begin() == this->emb_data());
- }
-
- embedded_vector &operator=(embedded_vector const &);
-
- iterator begin(){ return this->begin_; }
- const_iterator begin() const{ return this->begin_; }
- iterator end(){ return this->end_; }
- const_iterator end() const{ return this->end_; }
- reverse_iterator rbegin(){ return reverse_iterator(this->end()); }
- const_reverse_iterator rbegin() const{ return const_reverse_iterator(this->end()); }
- reverse_iterator rend(){ return reverse_iterator(this->begin()); }
- const_reverse_iterator rend() const{ return const_reverse_iterator(this->begin()); }
- size_type size() const{
- return this->end() - this->begin();
- }
- size_type max_size() const{
- if(Expand) return size_type(-1);
- else return EmbeddedSize;
- }
- void resize(size_type s,T const &c=T()){
- this->reserve(s);
- if(s > this->size()) copy_construct(this->end(),this->begin()+s,c);
- else destruct(this->begin()+s,this->end());
- this->end_=this->begin_+s;
- }
- size_type capacity() const{
- return this->end_storage - this->begin_;
- }
- bool empty() const{
- return this->begin() == this->end();
- }
- void reserve(size_type mincap){
- this->reserve(mincap,mpl::bool_<Expand>());
- }
- reference operator[](size_type n){
- BOOST_ASSERT(n < this->size());
- return *(this->begin() + n);
- }
- const_reference operator[](size_type n) const{
- BOOST_ASSERT(n < this->size());
- return *(this->begin() + n);
- }
- reference at(size_type);
- const_reference at(size_type) const;
-
- reference front(){ return *this->begin(); }
- const_reference front() const{ return *this->begin(); }
- reference back(){ return *this->rbegin(); }
- const_reference back() const{ return *this->rbegin(); }
-
- template<class InputIterator>
- void assign(InputIterator begin,InputIterator end);
- void assign(size_type n,T const &u);
-
- void push_back(T const &x){
- this->reserve_add(mpl::size_t<1>());
- new (this->end_) T(x);
- ++this->end_;
- }
-
- //extension to efficiently insert arrays.
- //insert(this->end(), ...) is not the same thing. even though the end() == end()
- //comparison can be optimized away if inlined, size must be statically known to get
- //an intrinsic memcpy for PODs.
- template<class Size>
- void push_back(T const *src,Size size){
- this->reserve_add(size);
- copy_construct_n(this->end_,src,size);
- this->end_+=size;
- }
-
- //extension to in-place construct a new element. elements of vectors with Expand==false
- //don't need to be copyconstructible using this:
- template<class InPlaceFactory>
- void push_back(InPlaceFactory const &fac){
- this->reserve_add(mpl::size_t<1>());
- fac.template apply<T>(this->end_);
- ++this->end_;
- }
+ typedef T &reference;
+ typedef T const &const_reference;
+ typedef T *iterator;
+ typedef T const *const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef T *pointer;
+ typedef T const *const_pointer;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ embedded_vector()
+ : begin_(emb_data())
+ , end_(emb_data())
+ , end_storage(emb_data() + EmbeddedSize){}
+
+ embedded_vector(size_type n,T const &value=T());
+ template<class InputIterator>
+ embedded_vector(InputIterator begin,InputIterator end);
+ embedded_vector(embedded_vector const &);
+ ~embedded_vector(){
+ destruct(this->begin(),this->end());
+ if(Expand){
+ if(this->begin() != this->emb_data()){
+ ::operator delete(this->begin_);
+ }
+ }else BOOST_ASSERT(this->begin() == this->emb_data());
+ }
+
+ embedded_vector &operator=(embedded_vector const &);
+
+ iterator begin(){ return this->begin_; }
+ const_iterator begin() const{ return this->begin_; }
+ iterator end(){ return this->end_; }
+ const_iterator end() const{ return this->end_; }
+ reverse_iterator rbegin(){ return reverse_iterator(this->end()); }
+ const_reverse_iterator rbegin() const{ return const_reverse_iterator(this->end()); }
+ reverse_iterator rend(){ return reverse_iterator(this->begin()); }
+ const_reverse_iterator rend() const{ return const_reverse_iterator(this->begin()); }
+ size_type size() const{
+ return this->end() - this->begin();
+ }
+ size_type max_size() const{
+ if(Expand) return size_type(-1);
+ else return EmbeddedSize;
+ }
+ void resize(size_type s,T const &c=T()){
+ this->reserve(s);
+ if(s > this->size()) copy_construct(this->end(),this->begin()+s,c);
+ else destruct(this->begin()+s,this->end());
+ this->end_=this->begin_+s;
+ }
+ size_type capacity() const{
+ return this->end_storage - this->begin_;
+ }
+ bool empty() const{
+ return this->begin() == this->end();
+ }
+ void reserve(size_type mincap){
+ this->reserve(mincap,mpl::bool_<Expand>());
+ }
+ reference operator[](size_type n){
+ BOOST_ASSERT(n < this->size());
+ return *(this->begin() + n);
+ }
+ const_reference operator[](size_type n) const{
+ BOOST_ASSERT(n < this->size());
+ return *(this->begin() + n);
+ }
+ reference at(size_type);
+ const_reference at(size_type) const;
+
+ reference front(){ return *this->begin(); }
+ const_reference front() const{ return *this->begin(); }
+ reference back(){ return *this->rbegin(); }
+ const_reference back() const{ return *this->rbegin(); }
+
+ template<class InputIterator>
+ void assign(InputIterator begin,InputIterator end);
+ void assign(size_type n,T const &u);
+
+ void push_back(T const &x){
+ this->reserve_add(mpl::size_t<1>());
+ new (this->end_) T(x);
+ ++this->end_;
+ }
+
+ //extension to efficiently insert arrays.
+ //insert(this->end(), ...) is not the same thing. even though the end() == end()
+ //comparison can be optimized away if inlined, size must be statically known to get
+ //an intrinsic memcpy for PODs.
+ template<class Size>
+ void push_back(T const *src,Size size){
+ this->reserve_add(size);
+ copy_construct_n(this->end_,src,size);
+ this->end_+=size;
+ }
+
+ //extension to in-place construct a new element. elements of vectors with Expand==false
+ //don't need to be copyconstructible using this:
+ template<class InPlaceFactory>
+ void push_back(InPlaceFactory const &fac){
+ this->reserve_add(mpl::size_t<1>());
+ fac.template apply<T>(this->end_);
+ ++this->end_;
+ }
 
- void pop_back();
- iterator insert(iterator position,T const &x);
+ void pop_back();
+ iterator insert(iterator position,T const &x);
     void insert(iterator position,size_type n,T const &x);
- template<class InputIterator>
+ template<class InputIterator>
     void insert(iterator position,InputIterator first,InputIterator last);
- iterator erase(iterator position);
- iterator erase(iterator begin,iterator end);
- void swap(embedded_vector &);
- void clear(){
- destruct(this->begin(),this->end());
- this->end_=this->begin();
- }
+ iterator erase(iterator position);
+ iterator erase(iterator begin,iterator end);
+ void swap(embedded_vector &);
+ void clear(){
+ destruct(this->begin(),this->end());
+ this->end_=this->begin();
+ }
 private:
- static void copy_construct(T *dest,T const *begin,T const *end){
- copy_construct_n(dest,begin,std::size_t(end-begin));
- }
- static void copy_construct(T *begin,T *end,T const &x){
- static bool const usememset=boost::is_pod<T>::value && sizeof(T) == 1;
- copy_construct(begin,end,x,mpl::bool_<usememset>());
- }
- static void copy_construct(T *begin,T *end,T const &x,mpl::true_ usememset){
- std::memset(begin,x,end-begin);
- }
- static void copy_construct(T *begin,T *end,T const &x,mpl::false_ usememset){
- T *it;
- try{
- for(it=begin;it != end;++it){
- new (it) T(x);
- }
- }catch(...){
- destruct(begin,it);
- throw;
- }
- }
- template<class Size>
- static void copy_construct_n(T *dest,T const *src,Size n){
- copy_construct_n(dest,src,n,typename is_pod<T>::type());
- }
- template<class Size>
- static void copy_construct_n(T *dest,T const *src,Size n,true_type pod){
- std::memcpy(dest,src,sizeof(T)*std::size_t(n));
- }
- template<class Size>
- static void copy_construct_n(T *dest,T const *src,Size n,false_type pod){
- std::size_t c;
- try{
- for(c=0;c<n;++c){
- new (dest+c) T(src[c]);
- }
- }catch(...){
- destruct(dest,dest+c);
- throw;
- }
- }
- static void destruct(T const *begin,T const *end){
- destruct(begin,end,typename is_pod<T>::type());
- }
- static void destruct(T const *begin,T const *end,true_type pod){}
- static void destruct(T const *begin,T const *end,false_type pod){
- for(T const *it=begin;it != end;++it){
- it->~T(); //nothrow
- }
- }
- //equivalent to reserve(size() + s)
- template<class Size>
- void reserve_add(Size s){
- this->reserve_add(s,mpl::bool_<Expand>());
- }
- template<class Size>
- void reserve_add(Size s,mpl::true_ expand){
- if(this->end_ + s > this->end_storage) this->reallocate(this->size()+s);
- }
- template<class Size>
- void reserve_add(Size s,mpl::false_ expand){
- BOOST_ASSERT(this->capacity() >= this->size() + s);
- }
-
- void reserve(size_type mincap,mpl::true_ expand){
- if(this->capacity() < mincap) this->reallocate(mincap);
- }
- void reserve(size_type mincap,mpl::false_ expand){
- BOOST_ASSERT(this->capacity() >= mincap);
- }
- void reallocate(size_type mincap){
- BOOST_ASSERT(mincap > this->capacity());
- size_type newcap=this->capacity() * 2;
- if(newcap < mincap) newcap=mincap;
- void *newdata=::operator new(newcap * sizeof(T));
- T *newbegin=reinterpret_cast<T *>(newdata);
- try{
- copy_construct(newbegin,this->begin(),this->end());
- destruct(this->begin(),this->end());
- }catch(...){ ::operator delete(newdata); throw; }
- this->end_=newbegin + this->size();
- this->end_storage=newbegin + newcap;
- if(this->begin() != this->emb_data()) ::operator delete(this->begin_);
- this->begin_=newbegin;
- }
- T *emb_data(){
- return reinterpret_cast<T *>(this->emb_data_);
- }
-
- char emb_data_[sizeof(T)*EmbeddedSize];
- T *begin_; //TODO optimization: begin_ and end_storage are not needed if Expand==false
- T *end_;
- T *end_storage;
+ static void copy_construct(T *dest,T const *begin,T const *end){
+ copy_construct_n(dest,begin,std::size_t(end-begin));
+ }
+ static void copy_construct(T *begin,T *end,T const &x){
+ static bool const usememset=boost::is_pod<T>::value && sizeof(T) == 1;
+ copy_construct(begin,end,x,mpl::bool_<usememset>());
+ }
+ static void copy_construct(T *begin,T *end,T const &x,mpl::true_ usememset){
+ std::memset(begin,x,end-begin);
+ }
+ static void copy_construct(T *begin,T *end,T const &x,mpl::false_ usememset){
+ T *it;
+ try{
+ for(it=begin;it != end;++it){
+ new (it) T(x);
+ }
+ }catch(...){
+ destruct(begin,it);
+ throw;
+ }
+ }
+ template<class Size>
+ static void copy_construct_n(T *dest,T const *src,Size n){
+ copy_construct_n(dest,src,n,typename is_pod<T>::type());
+ }
+ template<class Size>
+ static void copy_construct_n(T *dest,T const *src,Size n,true_type pod){
+ std::memcpy(dest,src,sizeof(T)*std::size_t(n));
+ }
+ template<class Size>
+ static void copy_construct_n(T *dest,T const *src,Size n,false_type pod){
+ std::size_t c;
+ try{
+ for(c=0;c<n;++c){
+ new (dest+c) T(src[c]);
+ }
+ }catch(...){
+ destruct(dest,dest+c);
+ throw;
+ }
+ }
+ static void destruct(T const *begin,T const *end){
+ destruct(begin,end,typename is_pod<T>::type());
+ }
+ static void destruct(T const *begin,T const *end,true_type pod){}
+ static void destruct(T const *begin,T const *end,false_type pod){
+ for(T const *it=begin;it != end;++it){
+ it->~T(); //nothrow
+ }
+ }
+ //equivalent to reserve(size() + s)
+ template<class Size>
+ void reserve_add(Size s){
+ this->reserve_add(s,mpl::bool_<Expand>());
+ }
+ template<class Size>
+ void reserve_add(Size s,mpl::true_ expand){
+ if(this->end_ + s > this->end_storage) this->reallocate(this->size()+s);
+ }
+ template<class Size>
+ void reserve_add(Size s,mpl::false_ expand){
+ BOOST_ASSERT(this->capacity() >= this->size() + s);
+ }
+
+ void reserve(size_type mincap,mpl::true_ expand){
+ if(this->capacity() < mincap) this->reallocate(mincap);
+ }
+ void reserve(size_type mincap,mpl::false_ expand){
+ BOOST_ASSERT(this->capacity() >= mincap);
+ }
+ void reallocate(size_type mincap){
+ BOOST_ASSERT(mincap > this->capacity());
+ size_type newcap=this->capacity() * 2;
+ if(newcap < mincap) newcap=mincap;
+ void *newdata=::operator new(newcap * sizeof(T));
+ T *newbegin=reinterpret_cast<T *>(newdata);
+ try{
+ copy_construct(newbegin,this->begin(),this->end());
+ destruct(this->begin(),this->end());
+ }catch(...){ ::operator delete(newdata); throw; }
+ this->end_=newbegin + this->size();
+ this->end_storage=newbegin + newcap;
+ if(this->begin() != this->emb_data()) ::operator delete(this->begin_);
+ this->begin_=newbegin;
+ }
+ T *emb_data(){
+ return reinterpret_cast<T *>(this->emb_data_);
+ }
+
+ char emb_data_[sizeof(T)*EmbeddedSize];
+ T *begin_; //TODO optimization: begin_ and end_storage are not needed if Expand==false
+ T *end_;
+ T *end_storage;
 };
 
 

Modified: sandbox/transaction/boost/transact/detail/filebuf_file.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/filebuf_file.hpp (original)
+++ sandbox/transaction/boost/transact/detail/filebuf_file.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -23,64 +23,64 @@
 
 class filebuf_seq_ofile{
 public:
- typedef unsigned long long size_type;
- explicit filebuf_seq_ofile(std::string const &name) : pos(0){
- if(!this->buf.open(name.c_str(),std::ios::out | std::ios::binary)) throw io_failure();
- }
- void save_binary(void const *data,mpl::size_t<1>){
- if(this->buf.sputc(*static_cast<char const *>(data)) == EOF) throw io_failure();
- ++this->pos;
- }
- void save_binary(void const *data,std::size_t size){
- std::streamsize ret=this->buf.sputn(static_cast<char const *>(data),std::streamsize(size));
- this->pos+=ret;
- if(ret != std::streamsize(size)) throw io_failure();
- }
- template<class T>
- void save(T const &t){
- this->save_binary(&t,mpl::size_t<sizeof(T)>());
- }
- size_type position() const{ return this->pos; }
- void flush(){
- if(this->buf.pubsync() != 0) throw io_failure();
- }
- void sync(){
- throw unsupported_operation();
- }
+ typedef unsigned long long size_type;
+ explicit filebuf_seq_ofile(std::string const &name) : pos(0){
+ if(!this->buf.open(name.c_str(),std::ios::out | std::ios::binary)) throw io_failure();
+ }
+ void save_binary(void const *data,mpl::size_t<1>){
+ if(this->buf.sputc(*static_cast<char const *>(data)) == EOF) throw io_failure();
+ ++this->pos;
+ }
+ void save_binary(void const *data,std::size_t size){
+ std::streamsize ret=this->buf.sputn(static_cast<char const *>(data),std::streamsize(size));
+ this->pos+=ret;
+ if(ret != std::streamsize(size)) throw io_failure();
+ }
+ template<class T>
+ void save(T const &t){
+ this->save_binary(&t,mpl::size_t<sizeof(T)>());
+ }
+ size_type position() const{ return this->pos; }
+ void flush(){
+ if(this->buf.pubsync() != 0) throw io_failure();
+ }
+ void sync(){
+ throw unsupported_operation();
+ }
 private:
- std::filebuf buf;
- size_type pos;
+ std::filebuf buf;
+ size_type pos;
 };
 
 class filebuf_seq_ifile{
 public:
- typedef unsigned long long size_type;
- explicit filebuf_seq_ifile(std::string const &name) : pos(0){
- if(!this->buf.open(name.c_str(),std::ios::in | std::ios::binary)) throw io_failure();
- }
- void load_binary(void *dataptr,mpl::size_t<1>){
- char &data=*static_cast<char *>(dataptr);
- int ret=this->buf.sbumpc();
- if(ret == EOF) throw eof_exception();
- ++this->pos;
- data=ret;
- }
- void load_binary(void *data,std::size_t size){
- std::streamsize ret=this->buf.sgetn(static_cast<char *>(data),std::streamsize(size));
- this->pos+=ret;
- if(ret != std::streamsize(size)){
- if(ret == 0) throw eof_exception();
- else throw io_failure();
- }
- }
- template<class T>
- void load(T &t){
- this->load_binary(&t,mpl::size_t<sizeof(T)>());
- }
- size_type position() const{ return this->pos; }
+ typedef unsigned long long size_type;
+ explicit filebuf_seq_ifile(std::string const &name) : pos(0){
+ if(!this->buf.open(name.c_str(),std::ios::in | std::ios::binary)) throw io_failure();
+ }
+ void load_binary(void *dataptr,mpl::size_t<1>){
+ char &data=*static_cast<char *>(dataptr);
+ int ret=this->buf.sbumpc();
+ if(ret == EOF) throw eof_exception();
+ ++this->pos;
+ data=ret;
+ }
+ void load_binary(void *data,std::size_t size){
+ std::streamsize ret=this->buf.sgetn(static_cast<char *>(data),std::streamsize(size));
+ this->pos+=ret;
+ if(ret != std::streamsize(size)){
+ if(ret == 0) throw eof_exception();
+ else throw io_failure();
+ }
+ }
+ template<class T>
+ void load(T &t){
+ this->load_binary(&t,mpl::size_t<sizeof(T)>());
+ }
+ size_type position() const{ return this->pos; }
 private:
- std::filebuf buf;
- size_type pos;
+ std::filebuf buf;
+ size_type pos;
 };
 
 

Modified: sandbox/transaction/boost/transact/detail/mutex.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/mutex.hpp (original)
+++ sandbox/transaction/boost/transact/detail/mutex.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -13,9 +13,9 @@
 namespace detail{
 
 struct null_lockable{
- void lock(){}
- bool try_lock(){ return true; }
- void unlock(){}
+ void lock(){}
+ bool try_lock(){ return true; }
+ void unlock(){}
 };
 
 }
@@ -34,35 +34,35 @@
 
 class combined_mutex{
 public:
- combined_mutex() : count(-1){
- this->smutex.lock();
- }
- void lock(){
- int old=this->count.fetch_add(1,boost::memory_order_acquire);
- if(old >= 0){
- try{
- this->smutex.lock();
- }catch(...){
- --this->count;
- throw;
- }
- }
- }
- void unlock(){
- int old=this->count.fetch_sub(1,boost::memory_order_release);
- BOOST_ASSERT(old >= 0);
- if(old > 0) this->smutex.unlock();
- }
- ~combined_mutex(){
- BOOST_ASSERT(this->count.load() == -1);
- this->smutex.unlock();
- }
+ combined_mutex() : count(-1){
+ this->smutex.lock();
+ }
+ void lock(){
+ int old=this->count.fetch_add(1,boost::memory_order_acquire);
+ if(old >= 0){
+ try{
+ this->smutex.lock();
+ }catch(...){
+ --this->count;
+ throw;
+ }
+ }
+ }
+ void unlock(){
+ int old=this->count.fetch_sub(1,boost::memory_order_release);
+ BOOST_ASSERT(old >= 0);
+ if(old > 0) this->smutex.unlock();
+ }
+ ~combined_mutex(){
+ BOOST_ASSERT(this->count.load() == -1);
+ this->smutex.unlock();
+ }
 private:
- boost::mutex smutex;
- boost::atomic<int> count;
+ boost::mutex smutex;
+ boost::atomic<int> count;
 };
 
-
+
 typedef combined_mutex mutex_type;
 
 

Modified: sandbox/transaction/boost/transact/detail/sectorizing_file.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/sectorizing_file.hpp (original)
+++ sandbox/transaction/boost/transact/detail/sectorizing_file.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -19,142 +19,142 @@
 template<class Base>
 class sectorizing_seq_ofile{
 public:
- typedef typename Base::size_type size_type;
- explicit sectorizing_seq_ofile(std::string const &name)
- : base(name)
- , size(0){}
- template<class Size>
- void save_binary(void const *data,Size s){
- if(this->size + s <= max_size){
- std::memcpy(this->buffer(this->size),data,s);
- this->size+=s;
- }else this->save_overflow(data,s);
- }
- template<class T>
- void save(T const &t){
- this->save_binary(&t,mpl::size_t<sizeof(T)>());
- }
- size_type position() const{
- return this->base.position() + this->size + 1;
- }
- void flush(){
- this->flush_buffer();
- this->base.flush();
- }
- void sync(){
- this->base.sync();
- }
- ~sectorizing_seq_ofile(){
- try{
- this->flush_buffer();
- }catch(...){
+ typedef typename Base::size_type size_type;
+ explicit sectorizing_seq_ofile(std::string const &name)
+ : base(name)
+ , size(0){}
+ template<class Size>
+ void save_binary(void const *data,Size s){
+ if(this->size + s <= max_size){
+ std::memcpy(this->buffer(this->size),data,s);
+ this->size+=s;
+ }else this->save_overflow(data,s);
+ }
+ template<class T>
+ void save(T const &t){
+ this->save_binary(&t,mpl::size_t<sizeof(T)>());
+ }
+ size_type position() const{
+ return this->base.position() + this->size + 1;
+ }
+ void flush(){
+ this->flush_buffer();
+ this->base.flush();
+ }
+ void sync(){
+ this->base.sync();
+ }
+ ~sectorizing_seq_ofile(){
+ try{
+ this->flush_buffer();
+ }catch(...){
 #ifndef NDEBUG
- std::cerr << "ignored exception" << std::endl;
+ std::cerr << "ignored exception" << std::endl;
 #endif
- }
- }
+ }
+ }
 private:
- static std::size_t const sector_size=512;
- static std::size_t const max_size=sector_size-2;
+ static std::size_t const sector_size=512;
+ static std::size_t const max_size=sector_size-2;
 
- void save_overflow(void const *data,std::size_t s){
- BOOST_ASSERT(this->size + s > max_size);
+ void save_overflow(void const *data,std::size_t s){
+ BOOST_ASSERT(this->size + s > max_size);
 
- std::size_t write=max_size-this->size;
- std::memcpy(this->buffer(this->size),data,write); this->size=max_size;
- std::size_t left=s - write;
- char const *cdata=static_cast<char const *>(data)+write;
- while(left > 0){
- this->flush_buffer(); BOOST_ASSERT(this->size == 0);
- if(left <= max_size) write=left;
- else write=max_size;
- std::memcpy(this->buffer(this->size),cdata,write); this->size+=write;
- left-=write; cdata+=write;
- }
- }
- void flush_buffer(){
- if(this->size > 0){
- BOOST_STATIC_ASSERT(max_size < (1 << 14));
- BOOST_ASSERT(this->size <= max_size);
- this->buffer_[0]=this->size | 0x80;
- this->buffer_[sector_size-1]=(this->size >> 7) | 0x80;
- this->base.save_binary(this->buffer_,mpl::size_t<sector_size>());
- this->size=0;
- }
- }
-
- char *buffer(std::size_t i){ return this->buffer_+i+1; }
-
- Base base;
- char buffer_[sector_size];
- std::size_t size;
+ std::size_t write=max_size-this->size;
+ std::memcpy(this->buffer(this->size),data,write); this->size=max_size;
+ std::size_t left=s - write;
+ char const *cdata=static_cast<char const *>(data)+write;
+ while(left > 0){
+ this->flush_buffer(); BOOST_ASSERT(this->size == 0);
+ if(left <= max_size) write=left;
+ else write=max_size;
+ std::memcpy(this->buffer(this->size),cdata,write); this->size+=write;
+ left-=write; cdata+=write;
+ }
+ }
+ void flush_buffer(){
+ if(this->size > 0){
+ BOOST_STATIC_ASSERT(max_size < (1 << 14));
+ BOOST_ASSERT(this->size <= max_size);
+ this->buffer_[0]=this->size | 0x80;
+ this->buffer_[sector_size-1]=(this->size >> 7) | 0x80;
+ this->base.save_binary(this->buffer_,mpl::size_t<sector_size>());
+ this->size=0;
+ }
+ }
+
+ char *buffer(std::size_t i){ return this->buffer_+i+1; }
+
+ Base base;
+ char buffer_[sector_size];
+ std::size_t size;
 };
 
 
 template<class Base>
 class sectorizing_seq_ifile{
 public:
- typedef typename Base::size_type size_type;
- explicit sectorizing_seq_ifile(std::string const &name)
- : base(name)
- , pos(0)
- , size(0){}
- template<class Size>
- void load_binary(void *data,Size s){
- if(this->size == 0 || this->pos == this->size) this->load_sector();
- if(this->pos + s <= this->size){
- std::memcpy(data,this->buffer(this->pos),s);
- this->pos+=s;
- }else{
- try{
- std::size_t read=this->size - this->pos;
- BOOST_ASSERT(read > 0);
- std::memcpy(data,this->buffer(this->pos),read); this->pos+=read;
- std::size_t left=s - read;
- char *cdata=static_cast<char *>(data)+read;
- while(left > 0){
- this->load_sector();
- if(left <= this->size) read=left; else read=this->size;
- std::memcpy(cdata,this->buffer(this->pos),read); this->pos+=read;
- left-=read; cdata+=read;
- }
- }catch(eof_exception &){
- //at least some data was read, real EOFs are thrown above
- throw io_failure();
- }
- }
- }
- template<class T>
- void load(T &t){
- this->load_binary(&t,mpl::size_t<sizeof(T)>());
- }
- size_type position() const;
+ typedef typename Base::size_type size_type;
+ explicit sectorizing_seq_ifile(std::string const &name)
+ : base(name)
+ , pos(0)
+ , size(0){}
+ template<class Size>
+ void load_binary(void *data,Size s){
+ if(this->size == 0 || this->pos == this->size) this->load_sector();
+ if(this->pos + s <= this->size){
+ std::memcpy(data,this->buffer(this->pos),s);
+ this->pos+=s;
+ }else{
+ try{
+ std::size_t read=this->size - this->pos;
+ BOOST_ASSERT(read > 0);
+ std::memcpy(data,this->buffer(this->pos),read); this->pos+=read;
+ std::size_t left=s - read;
+ char *cdata=static_cast<char *>(data)+read;
+ while(left > 0){
+ this->load_sector();
+ if(left <= this->size) read=left; else read=this->size;
+ std::memcpy(cdata,this->buffer(this->pos),read); this->pos+=read;
+ left-=read; cdata+=read;
+ }
+ }catch(eof_exception &){
+ //at least some data was read, real EOFs are thrown above
+ throw io_failure();
+ }
+ }
+ }
+ template<class T>
+ void load(T &t){
+ this->load_binary(&t,mpl::size_t<sizeof(T)>());
+ }
+ size_type position() const;
 private:
- void load_sector(){
- BOOST_ASSERT(this->pos == this->size);
- do{
- this->base.load_binary(this->buffer_,mpl::size_t<sector_size>());
- if(this->buffer_[0] == 0 || this->buffer_[sector_size-1] == 0) throw eof_exception();
- this->size=((this->buffer_[sector_size-1] & 0x7f) << 7) | (this->buffer_[0] & 0x7f);
- if(this->size > max_size) throw io_failure();
- }while(this->size == 0);
- this->pos=0;
- }
-
-
- char *buffer(std::size_t p){
- return this->buffer_+p+data_begin;
- }
-
- static std::size_t const sector_size=512;
- static std::size_t const data_begin=1;
- static std::size_t const data_end=sector_size-1;
- static std::size_t const max_size=data_end-data_begin;
-
- Base base;
- char buffer_[sector_size];
- std::size_t pos;
- std::size_t size;
+ void load_sector(){
+ BOOST_ASSERT(this->pos == this->size);
+ do{
+ this->base.load_binary(this->buffer_,mpl::size_t<sector_size>());
+ if(this->buffer_[0] == 0 || this->buffer_[sector_size-1] == 0) throw eof_exception();
+ this->size=((this->buffer_[sector_size-1] & 0x7f) << 7) | (this->buffer_[0] & 0x7f);
+ if(this->size > max_size) throw io_failure();
+ }while(this->size == 0);
+ this->pos=0;
+ }
+
+
+ char *buffer(std::size_t p){
+ return this->buffer_+p+data_begin;
+ }
+
+ static std::size_t const sector_size=512;
+ static std::size_t const data_begin=1;
+ static std::size_t const data_end=sector_size-1;
+ static std::size_t const max_size=data_end-data_begin;
+
+ Base base;
+ char buffer_[sector_size];
+ std::size_t pos;
+ std::size_t size;
 };
 
 

Modified: sandbox/transaction/boost/transact/detail/static_tss.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/static_tss.hpp (original)
+++ sandbox/transaction/boost/transact/detail/static_tss.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -21,24 +21,24 @@
 template<class T,class Tag>
 class static_thread_specific_ptr<T,Tag,true> : noncopyable{
 private:
- static_thread_specific_ptr();
+ static_thread_specific_ptr();
 public:
 
 #if ((__GNUC__== 3) && (__GNUC_MINOR__ > 4) || __GNUC__>= 4)
- static void reset(T *p=0){ ptr=p; }
- static T *get(){ return ptr; }
+ static void reset(T *p=0){ ptr=p; }
+ static T *get(){ return ptr; }
 private:
- static __thread T *ptr;
+ static __thread T *ptr;
 };
 
 template<class T,class Tag>
 __thread T *static_thread_specific_ptr<T,Tag,true>::ptr(0);
 
 #elif defined(BOOST_MSVC)
- static void reset(T *p=0){ ptr=p; }
- static T *get(){ return ptr; }
+ static void reset(T *p=0){ ptr=p; }
+ static T *get(){ return ptr; }
 private:
- static __declspec(thread) T *ptr;
+ static __declspec(thread) T *ptr;
 };
 
 template<class T,class Tag>
@@ -46,10 +46,10 @@
 
 
 #else
- static void reset(T *p=0){ ptr.reset(p); }
- static T *get(){ return ptr.get(); }
+ static void reset(T *p=0){ ptr.reset(p); }
+ static T *get(){ return ptr.get(); }
 private:
- static thread_specific_ptr<T> ptr;
+ static thread_specific_ptr<T> ptr;
 };
 
 template<class T,class Tag>
@@ -60,12 +60,12 @@
 template<class T,class Tag>
 class static_thread_specific_ptr<T,Tag,false> : noncopyable{
 private:
- static_thread_specific_ptr();
+ static_thread_specific_ptr();
 public:
- static void reset(T *p=0){ ptr=p; }
- static T *get(){ return ptr; }
+ static void reset(T *p=0){ ptr=p; }
+ static T *get(){ return ptr; }
 private:
- static T *ptr;
+ static T *ptr;
 };
 
 template<class T,class Tag>

Modified: sandbox/transaction/boost/transact/detail/syncing_file.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/syncing_file.hpp (original)
+++ sandbox/transaction/boost/transact/detail/syncing_file.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -41,48 +41,48 @@
 
 class syncing_seq_ofile{
 public:
- typedef unsigned long long size_type;
- explicit syncing_seq_ofile(std::string const &name);
- void save_binary(void const *data,std::size_t size);
- template<class T>
- void save(T const &t){
- this->save_binary(&t,mpl::size_t<sizeof(T)>());
- }
- size_type position() const{ return this->pos; }
- void flush();
- void sync();
+ typedef unsigned long long size_type;
+ explicit syncing_seq_ofile(std::string const &name);
+ void save_binary(void const *data,std::size_t size);
+ template<class T>
+ void save(T const &t){
+ this->save_binary(&t,mpl::size_t<sizeof(T)>());
+ }
+ size_type position() const{ return this->pos; }
+ void flush();
+ void sync();
 private:
- size_type pos;
+ size_type pos;
 #ifdef WIN32
 #else
 public:
- ~syncing_seq_ofile(){
- if(this->filedes != -1) ::close(this->filedes);
- }
+ ~syncing_seq_ofile(){
+ if(this->filedes != -1) ::close(this->filedes);
+ }
 private:
- void write_ahead(size_type const &s){
- BOOST_ASSERT(s % write_ahead_size == 0);
- if(this->pos != s){
- if(::lseek64(this->filedes,s,SEEK_SET) != off64_t(s)) throw io_failure();
- }
- char data[write_page_size]; memset(data,0,write_page_size);
- BOOST_STATIC_ASSERT(write_ahead_size % write_page_size == 0);
- for(std::size_t c=0;c<write_ahead_size / write_page_size;++c){
- if(::write(this->filedes,data,write_page_size) != ssize_t(write_page_size)) throw io_failure();
- }
- if(::fsync(this->filedes) != 0) throw io_failure();
- if(::lseek64(this->filedes,this->pos,SEEK_SET) != off64_t(this->pos)) throw io_failure();
- }
- void write_ahead(size_type const &start,size_type const &end){
- BOOST_ASSERT(start % write_ahead_size == 0);
- BOOST_ASSERT(end % write_ahead_size == 0);
- for(size_type off=start;off < end;off+=write_ahead_size) this->write_ahead(off);
- }
+ void write_ahead(size_type const &s){
+ BOOST_ASSERT(s % write_ahead_size == 0);
+ if(this->pos != s){
+ if(::lseek64(this->filedes,s,SEEK_SET) != off64_t(s)) throw io_failure();
+ }
+ char data[write_page_size]; memset(data,0,write_page_size);
+ BOOST_STATIC_ASSERT(write_ahead_size % write_page_size == 0);
+ for(std::size_t c=0;c<write_ahead_size / write_page_size;++c){
+ if(::write(this->filedes,data,write_page_size) != ssize_t(write_page_size)) throw io_failure();
+ }
+ if(::fsync(this->filedes) != 0) throw io_failure();
+ if(::lseek64(this->filedes,this->pos,SEEK_SET) != off64_t(this->pos)) throw io_failure();
+ }
+ void write_ahead(size_type const &start,size_type const &end){
+ BOOST_ASSERT(start % write_ahead_size == 0);
+ BOOST_ASSERT(end % write_ahead_size == 0);
+ for(size_type off=start;off < end;off+=write_ahead_size) this->write_ahead(off);
+ }
 
- static std::size_t const write_ahead_size=10*1024*1024;
- static std::size_t const write_page_size=4096;
+ static std::size_t const write_ahead_size=10*1024*1024;
+ static std::size_t const write_page_size=4096;
 
- int filedes;
+ int filedes;
 #endif
 };
 
@@ -90,46 +90,46 @@
 #else
 
 inline syncing_seq_ofile::syncing_seq_ofile(std::string const &name)
- : pos(0)
- , filedes(-1){
- int flags=O_CREAT | O_WRONLY;
+ : pos(0)
+ , filedes(-1){
+ int flags=O_CREAT | O_WRONLY;
 #ifdef linux
- flags|=O_NOATIME;
+ flags|=O_NOATIME;
 #endif
- this->filedes=::open(name.c_str(),flags,S_IRUSR | S_IWUSR);
- if(this->filedes==-1) throw io_failure();
- { //make sure the directory entry has reached the disk:
- std::string dirname=filesystem::path(name).directory_string();
- if(dirname.empty()) dirname=".";
- int dirfd=::open(dirname.c_str(),O_RDONLY);
- if(dirfd==-1) throw io_failure();
- int ret=::fsync(dirfd);
- if(::close(dirfd) != 0 || ret != 0) throw io_failure();
- }
- this->write_ahead(0);
+ this->filedes=::open(name.c_str(),flags,S_IRUSR | S_IWUSR);
+ if(this->filedes==-1) throw io_failure();
+ { //make sure the directory entry has reached the disk:
+ std::string dirname=filesystem::path(name).directory_string();
+ if(dirname.empty()) dirname=".";
+ int dirfd=::open(dirname.c_str(),O_RDONLY);
+ if(dirfd==-1) throw io_failure();
+ int ret=::fsync(dirfd);
+ if(::close(dirfd) != 0 || ret != 0) throw io_failure();
+ }
+ this->write_ahead(0);
 }
 
 void syncing_seq_ofile::save_binary(void const *data,std::size_t size){
- size_type const s=this->pos % write_ahead_size;
- if(s + size >= write_ahead_size){ //there must be at least one 0 at the and, so also write ahead if this is equal.
- size_type start=this->pos - s + write_ahead_size;
- size_type end=start+((s + size)/write_ahead_size) * write_ahead_size; //usually == start + write_ahead_size, but "size" can theoretically span a whole write_ahead_size
- BOOST_ASSERT(end > start);
- this->write_ahead(start,end);
- }
-
- ssize_t ret=::write(this->filedes,data,size);
- if(ret > 0) this->pos+=ret;
- if(ret != ssize_t(size)) throw io_failure();
+ size_type const s=this->pos % write_ahead_size;
+ if(s + size >= write_ahead_size){ //there must be at least one 0 at the and, so also write ahead if this is equal.
+ size_type start=this->pos - s + write_ahead_size;
+ size_type end=start+((s + size)/write_ahead_size) * write_ahead_size; //usually == start + write_ahead_size, but "size" can theoretically span a whole write_ahead_size
+ BOOST_ASSERT(end > start);
+ this->write_ahead(start,end);
+ }
+
+ ssize_t ret=::write(this->filedes,data,size);
+ if(ret > 0) this->pos+=ret;
+ if(ret != ssize_t(size)) throw io_failure();
 }
 
 
 inline void syncing_seq_ofile::flush(){}
 inline void syncing_seq_ofile::sync(){
 #ifdef linux
- if(::fdatasync(this->filedes) != 0) throw io_failure();
+ if(::fdatasync(this->filedes) != 0) throw io_failure();
 #else //multiple sources say fdatasync is not safe on other systems
- if(::fsync(this->filedes) != 0) throw io_failure();
+ if(::fsync(this->filedes) != 0) throw io_failure();
 #endif
 }
 

Modified: sandbox/transaction/boost/transact/exception.hpp
==============================================================================
--- sandbox/transaction/boost/transact/exception.hpp (original)
+++ sandbox/transaction/boost/transact/exception.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -53,22 +53,22 @@
 
 template<class TxMgr,class Iterator>
 struct isolation_unwind_visitor{
- void operator()(isolation_exception const &iso){
- typedef typename mpl::deref<Iterator>::type resource_type;
- if(resource_isolation_exception<resource_type> const *viso=dynamic_cast<resource_isolation_exception<resource_type> const *>(&iso)){
- viso->template unwind<TxMgr>();
- }else{
- isolation_unwind_visitor<TxMgr,typename mpl::next<Iterator>::type> visit;
- visit(iso);
- }
- }
+ void operator()(isolation_exception const &iso){
+ typedef typename mpl::deref<Iterator>::type resource_type;
+ if(resource_isolation_exception<resource_type> const *viso=dynamic_cast<resource_isolation_exception<resource_type> const *>(&iso)){
+ viso->template unwind<TxMgr>();
+ }else{
+ isolation_unwind_visitor<TxMgr,typename mpl::next<Iterator>::type> visit;
+ visit(iso);
+ }
+ }
 };
 
 template<class TxMgr>
 struct isolation_unwind_visitor<TxMgr,typename mpl::end<typename TxMgr::resource_types>::type>{
- void operator()(isolation_exception const &){
- BOOST_ASSERT(false);
- }
+ void operator()(isolation_exception const &){
+ BOOST_ASSERT(false);
+ }
 };
 
 }
@@ -78,15 +78,15 @@
 ///\c isolation_exception is an abstract base class. The derived class
 ///\c resource_isolation_exception can be used to throw this exception.
 struct isolation_exception : transact::exception{
- ///Rethrows the exception if the active transaction is a nested transaction but the isolation exception was caused by a parent transaction of it.
- template<class TxMgr>
- void unwind() const{ //pseudo-virtual
- detail::isolation_unwind_visitor<TxMgr,typename mpl::begin<typename TxMgr::resource_types>::type> visit;
- visit(*this);
- }
- virtual ~isolation_exception()throw (){}
+ ///Rethrows the exception if the active transaction is a nested transaction but the isolation exception was caused by a parent transaction of it.
+ template<class TxMgr>
+ void unwind() const{ //pseudo-virtual
+ detail::isolation_unwind_visitor<TxMgr,typename mpl::begin<typename TxMgr::resource_types>::type> visit;
+ visit(*this);
+ }
+ virtual ~isolation_exception()throw (){}
 protected:
- isolation_exception(){}
+ isolation_exception(){}
 };
 
 
@@ -96,23 +96,23 @@
 ///in order to catch isolation exceptions of all resource managers.
 template<class ResMgr>
 struct resource_isolation_exception : isolation_exception{
- ///\brief Constructs a resource_isolation_exception
- ///\param unwind_to A pointer to the transaction that ought to be active when
- ///unwind() returns. Must be a transaction on the nested transaction
- ///stack. If 0, unwind() rethrows the exception until all transactions
- ///including the root transaction are destroyed.
- explicit resource_isolation_exception(typename ResMgr::transaction *unwind_to)
- : to(unwind_to){}
- ///\brief Equivalent to <tt>isolation_exception::unwind<TxMgr>()</tt>
- template<class TxMgr>
- void unwind() const{ //pseudo-virtual
- if(this->to){
- typename ResMgr::transaction &tx=TxMgr::resource_transaction(TxMgr::active_transaction(),typename ResMgr::tag());
- if(&tx != this->to) throw;
- }else if(TxMgr::has_active_transaction()) throw;
- }
+ ///\brief Constructs a resource_isolation_exception
+ ///\param unwind_to A pointer to the transaction that ought to be active when
+ ///unwind() returns. Must be a transaction on the nested transaction
+ ///stack. If 0, unwind() rethrows the exception until all transactions
+ ///including the root transaction are destroyed.
+ explicit resource_isolation_exception(typename ResMgr::transaction *unwind_to)
+ : to(unwind_to){}
+ ///\brief Equivalent to <tt>isolation_exception::unwind<TxMgr>()</tt>
+ template<class TxMgr>
+ void unwind() const{ //pseudo-virtual
+ if(this->to){
+ typename ResMgr::transaction &tx=TxMgr::resource_transaction(TxMgr::active_transaction(),typename ResMgr::tag());
+ if(&tx != this->to) throw;
+ }else if(TxMgr::has_active_transaction()) throw;
+ }
 private:
- typename ResMgr::transaction *to;
+ typename ResMgr::transaction *to;
 };
 
 }

Modified: sandbox/transaction/boost/transact/log.hpp
==============================================================================
--- sandbox/transaction/boost/transact/log.hpp (original)
+++ sandbox/transaction/boost/transact/log.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -43,33 +43,33 @@
 
 template<class OutputIterator>
 static void get_existing_log_ids(OutputIterator out,std::string const &name){
- namespace fs=boost::filesystem;
- try{
- fs::path dir=fs::path(name).remove_filename();
- std::string filename=fs::path(name).filename();
- fs::directory_iterator it;
- if(dir.empty()) it=fs::directory_iterator(".");
- else it=fs::directory_iterator(dir);
- for(;it != fs::directory_iterator();++it){
- std::string foundfilename=it->path().filename();
- if(foundfilename.substr(0,filename.length()+1) != filename+".") continue;
- std::string nrstring=foundfilename.substr(filename.length()+1);
- unsigned int nr;
- try{ nr=lexical_cast<unsigned int>(nrstring); } catch(...){ continue; }
- *out++=nr;
- }
- }catch(...){
- throw io_failure();
- }
+ namespace fs=boost::filesystem;
+ try{
+ fs::path dir=fs::path(name).remove_filename();
+ std::string filename=fs::path(name).filename();
+ fs::directory_iterator it;
+ if(dir.empty()) it=fs::directory_iterator(".");
+ else it=fs::directory_iterator(dir);
+ for(;it != fs::directory_iterator();++it){
+ std::string foundfilename=it->path().filename();
+ if(foundfilename.substr(0,filename.length()+1) != filename+".") continue;
+ std::string nrstring=foundfilename.substr(filename.length()+1);
+ unsigned int nr;
+ try{ nr=lexical_cast<unsigned int>(nrstring); } catch(...){ continue; }
+ *out++=nr;
+ }
+ }catch(...){
+ throw io_failure();
+ }
 }
 static unsigned int get_next_log_id(std::string const &name){
- std::vector<unsigned int> ids;
- get_existing_log_ids(std::back_inserter(ids),name);
- return ids.empty() ? 1 : *std::max_element(ids.begin(),ids.end())+1;
+ std::vector<unsigned int> ids;
+ get_existing_log_ids(std::back_inserter(ids),name);
+ return ids.empty() ? 1 : *std::max_element(ids.begin(),ids.end())+1;
 }
 
 static std::string get_log_filename(std::string const &name,unsigned int l){
- return name+'.'+lexical_cast<std::string>(l);
+ return name+'.'+lexical_cast<std::string>(l);
 }
 
 }
@@ -78,230 +78,230 @@
 template<bool Sync>
 class olog_files{
 public:
- olog_files(std::string const &name,unsigned int max_log_size)
- : log_id(detail::get_next_log_id(name))
- , rolling_(false)
- , max_log_size(max_log_size)
- , header_size(0)
- , name(name)
- , file(new file_type(detail::get_log_filename(name,log_id))){}
-
- //Archive interface
- template<class T>
- olog_files &operator<<(T const &t){
- this->file->save(t);
- return *this;
- }
- template<class T>
- olog_files &operator&(T const &t){ return this->operator<<(t); }
- template<class Size>
- void save_binary(void const *data,Size size){
- this->file->save_binary(data,size);
- }
- typedef mpl::true_ is_saving;
- typedef mpl::false_ is_loading;
-
-
- bool overflow() const{
- return (!this->rolling())
- && (this->file->position() > this->max_log_size + this->header_size);
- }
-
-
- bool rolling() const{ return this->rolling_; }
- template<class Header>
- void begin_roll(Header header){
- BOOST_ASSERT(!this->rolling());
- this->rolling_=true;
- try{
- //first construct the new log and then replace it. if construction
- //of new log file fails, there must still be a valid file in this->file
- //for other threads:
- this->file.reset(new file_type(detail::get_log_filename(this->name,this->log_id+1)));
- ++this->log_id;
- header();
- this->header_size=this->file->position();
- }catch(...){
- this->rolling_=false;
- throw;
- }
- }
-
- void commit_roll(){
- BOOST_ASSERT(this->rolling_);
- this->flush();
- this->sync(); //TODO optimization: outside of lock
- //TODO optimization: don't remove, but invalidate and rename to the next log. increases
- //performance of writing ahead if the file is already fully "allocated".
-
- try{
- filesystem::remove(detail::get_log_filename(this->name,this->log_id-1));
- }catch(...){
- throw io_failure();
- }
- this->rolling_=false;
- }
-
- void flush(){
- this->file->flush();
- }
- void sync(){
- this->file->sync();
- }
+ olog_files(std::string const &name,unsigned int max_log_size)
+ : log_id(detail::get_next_log_id(name))
+ , rolling_(false)
+ , max_log_size(max_log_size)
+ , header_size(0)
+ , name(name)
+ , file(new file_type(detail::get_log_filename(name,log_id))){}
+
+ //Archive interface
+ template<class T>
+ olog_files &operator<<(T const &t){
+ this->file->save(t);
+ return *this;
+ }
+ template<class T>
+ olog_files &operator&(T const &t){ return this->operator<<(t); }
+ template<class Size>
+ void save_binary(void const *data,Size size){
+ this->file->save_binary(data,size);
+ }
+ typedef mpl::true_ is_saving;
+ typedef mpl::false_ is_loading;
+
+
+ bool overflow() const{
+ return (!this->rolling())
+ && (this->file->position() > this->max_log_size + this->header_size);
+ }
+
+
+ bool rolling() const{ return this->rolling_; }
+ template<class Header>
+ void begin_roll(Header header){
+ BOOST_ASSERT(!this->rolling());
+ this->rolling_=true;
+ try{
+ //first construct the new log and then replace it. if construction
+ //of new log file fails, there must still be a valid file in this->file
+ //for other threads:
+ this->file.reset(new file_type(detail::get_log_filename(this->name,this->log_id+1)));
+ ++this->log_id;
+ header();
+ this->header_size=this->file->position();
+ }catch(...){
+ this->rolling_=false;
+ throw;
+ }
+ }
+
+ void commit_roll(){
+ BOOST_ASSERT(this->rolling_);
+ this->flush();
+ this->sync(); //TODO optimization: outside of lock
+ //TODO optimization: don't remove, but invalidate and rename to the next log. increases
+ //performance of writing ahead if the file is already fully "allocated".
+
+ try{
+ filesystem::remove(detail::get_log_filename(this->name,this->log_id-1));
+ }catch(...){
+ throw io_failure();
+ }
+ this->rolling_=false;
+ }
+
+ void flush(){
+ this->file->flush();
+ }
+ void sync(){
+ this->file->sync();
+ }
 private:
- typedef typename mpl::if_c<
- Sync,
- detail::sectorizing_seq_ofile<
- detail::aligning_seq_ofile<
- detail::buffering_seq_ofile<
- detail::syncing_seq_ofile,
- 8192
- >
- >
- >,
- detail::buffering_seq_ofile<
- detail::filebuf_seq_ofile,
- 8192
- >
- >::type file_type;
-
- unsigned int log_id;
- bool rolling_;
- typename file_type::size_type max_log_size;
- typename file_type::size_type header_size;
- std::string const name;
- scoped_ptr<file_type> file; //no optional. see begin_roll()
+ typedef typename mpl::if_c<
+ Sync,
+ detail::sectorizing_seq_ofile<
+ detail::aligning_seq_ofile<
+ detail::buffering_seq_ofile<
+ detail::syncing_seq_ofile,
+ 8192
+ >
+ >
+ >,
+ detail::buffering_seq_ofile<
+ detail::filebuf_seq_ofile,
+ 8192
+ >
+ >::type file_type;
+
+ unsigned int log_id;
+ bool rolling_;
+ typename file_type::size_type max_log_size;
+ typename file_type::size_type header_size;
+ std::string const name;
+ scoped_ptr<file_type> file; //no optional. see begin_roll()
 };
 
 template<bool Sync>
 class otransaction_log_files : public olog_files<Sync>{
 private:
- struct detail{
- typedef unsigned int transaction;
- };
+ struct detail{
+ typedef unsigned int transaction;
+ };
 public:
- typedef typename detail::transaction transaction;
- otransaction_log_files(std::string const &name,std::size_t max_log_size)
- : olog_files<Sync>(name,max_log_size)
- , next_tx(1)
- , open_transactions(0)
- , rolled_transactions(0)
- , roll_cutoff(0){}
-
- template<class Header>
- typename detail::transaction begin_transaction(Header header){
- transaction tx=this->next_tx++;
- if(this->overflow()){
- this->begin_roll(header);
- this->roll_cutoff=tx;
- BOOST_ASSERT(this->rolled_transactions==0);
- this->rolled_transactions=this->open_transactions;
- this->open_transactions=0;
- }
- BOOST_ASSERT(!this->rolling() || tx >= this->roll_cutoff);
- ++this->open_transactions;
- return tx;
- }
- void end_transaction(transaction tx){
- if(this->rolling() && tx < this->roll_cutoff){
- BOOST_ASSERT(this->rolled_transactions > 0);
- --this->rolled_transactions;
- if(this->rolled_transactions==0){
- //all transactions that were begun in the old, rolled, log have ended.
- this->commit_roll();
- }
- }else{
- BOOST_ASSERT(this->open_transactions > 0);
- --this->open_transactions;
- }
- }
+ typedef typename detail::transaction transaction;
+ otransaction_log_files(std::string const &name,std::size_t max_log_size)
+ : olog_files<Sync>(name,max_log_size)
+ , next_tx(1)
+ , open_transactions(0)
+ , rolled_transactions(0)
+ , roll_cutoff(0){}
+
+ template<class Header>
+ typename detail::transaction begin_transaction(Header header){
+ transaction tx=this->next_tx++;
+ if(this->overflow()){
+ this->begin_roll(header);
+ this->roll_cutoff=tx;
+ BOOST_ASSERT(this->rolled_transactions==0);
+ this->rolled_transactions=this->open_transactions;
+ this->open_transactions=0;
+ }
+ BOOST_ASSERT(!this->rolling() || tx >= this->roll_cutoff);
+ ++this->open_transactions;
+ return tx;
+ }
+ void end_transaction(transaction tx){
+ if(this->rolling() && tx < this->roll_cutoff){
+ BOOST_ASSERT(this->rolled_transactions > 0);
+ --this->rolled_transactions;
+ if(this->rolled_transactions==0){
+ //all transactions that were begun in the old, rolled, log have ended.
+ this->commit_roll();
+ }
+ }else{
+ BOOST_ASSERT(this->open_transactions > 0);
+ --this->open_transactions;
+ }
+ }
 private:
- transaction next_tx;
- std::size_t open_transactions;
- std::size_t rolled_transactions;
- transaction roll_cutoff;
+ transaction next_tx;
+ std::size_t open_transactions;
+ std::size_t rolled_transactions;
+ transaction roll_cutoff;
 };
 
 template<bool Sync>
 class ilog_files{
 public:
- explicit ilog_files(std::string const &name) : name(name){
- detail::get_existing_log_ids(std::inserter(this->log_ids,this->log_ids.begin()),name);
- this->current=this->log_ids.begin();
-
- //although the current implementation of log rolling only produces a maximum of
- //2 logs at a time, an aborted recovery may have created another log. work through all of them.
-
- for(log_ids_type::const_iterator next=this->log_ids.begin();next!=this->log_ids.end();){
- log_ids_type::const_iterator it=next++;
- if(next != this->log_ids.end() && (*it != *next-1)) throw io_failure();
- }
-
- if(this->current != this->log_ids.end()){
- this->file=in_place(detail::get_log_filename(this->name,*this->current));
- }
- }
- //Archive interface
- template<class T>
- ilog_files &operator>>(T const &t){
- this->file->load(t);
- return *this;
- }
- template<class T>
- ilog_files &operator&(T const &t){ return this->operator>>(t); }
- template<class Size>
- void load_binary(void *data,Size size){
- this->file->load_binary(data,size);
- }
- typedef mpl::true_ is_saving;
- typedef mpl::false_ is_loading;
- void remove(){
- try{
- for(log_ids_type::const_iterator it=this->log_ids.begin();it != this->log_ids.end();++it){
- filesystem::remove(detail::get_log_filename(this->name,*it));
- //FIXME sync directory entry. the delete of an older log
- //must have reached disk before a newer log is deleted.
- }
- }catch(...){
- throw io_failure();
- }
- }
+ explicit ilog_files(std::string const &name) : name(name){
+ detail::get_existing_log_ids(std::inserter(this->log_ids,this->log_ids.begin()),name);
+ this->current=this->log_ids.begin();
+
+ //although the current implementation of log rolling only produces a maximum of
+ //2 logs at a time, an aborted recovery may have created another log. work through all of them.
+
+ for(log_ids_type::const_iterator next=this->log_ids.begin();next!=this->log_ids.end();){
+ log_ids_type::const_iterator it=next++;
+ if(next != this->log_ids.end() && (*it != *next-1)) throw io_failure();
+ }
+
+ if(this->current != this->log_ids.end()){
+ this->file=in_place(detail::get_log_filename(this->name,*this->current));
+ }
+ }
+ //Archive interface
+ template<class T>
+ ilog_files &operator>>(T const &t){
+ this->file->load(t);
+ return *this;
+ }
+ template<class T>
+ ilog_files &operator&(T const &t){ return this->operator>>(t); }
+ template<class Size>
+ void load_binary(void *data,Size size){
+ this->file->load_binary(data,size);
+ }
+ typedef mpl::true_ is_saving;
+ typedef mpl::false_ is_loading;
+ void remove(){
+ try{
+ for(log_ids_type::const_iterator it=this->log_ids.begin();it != this->log_ids.end();++it){
+ filesystem::remove(detail::get_log_filename(this->name,*it));
+ //FIXME sync directory entry. the delete of an older log
+ //must have reached disk before a newer log is deleted.
+ }
+ }catch(...){
+ throw io_failure();
+ }
+ }
 private:
- typedef std::set<unsigned int> log_ids_type;
- log_ids_type log_ids;
- log_ids_type::const_iterator current;
- std::string const name;
- typedef typename mpl::if_c<
- Sync,
- detail::sectorizing_seq_ifile<detail::filebuf_seq_ifile>,
- detail::filebuf_seq_ifile
- >::type file_type;
- optional<file_type> file;
+ typedef std::set<unsigned int> log_ids_type;
+ log_ids_type log_ids;
+ log_ids_type::const_iterator current;
+ std::string const name;
+ typedef typename mpl::if_c<
+ Sync,
+ detail::sectorizing_seq_ifile<detail::filebuf_seq_ifile>,
+ detail::filebuf_seq_ifile
+ >::type file_type;
+ optional<file_type> file;
 };
 
 namespace detail{
 
 template<class Entry,class State>
 struct make_entry_pair{
- typedef mpl::pair<
- Entry,
- typename mpl::size<State>::type
- > type;
+ typedef mpl::pair<
+ Entry,
+ typename mpl::size<State>::type
+ > type;
 };
 
 template<class Vector>
 struct invert_vector{
- typedef typename mpl::fold<
- Vector,
- mpl::map0<>,
- mpl::insert<
- mpl::_1,
- make_entry_pair<
- mpl::_2,
- mpl::_1
- >
- >
- >::type type;
+ typedef typename mpl::fold<
+ Vector,
+ mpl::map0<>,
+ mpl::insert<
+ mpl::_1,
+ make_entry_pair<
+ mpl::_2,
+ mpl::_1
+ >
+ >
+ >::type type;
 };
 
 }
@@ -309,122 +309,122 @@
 template<class Entries,bool Sync>
 class olog{
 private:
- typedef typename detail::invert_vector<Entries>::type ids;
+ typedef typename detail::invert_vector<Entries>::type ids;
 public:
- typedef unsigned char id_type;
- explicit olog(olog_files<Sync> &files)
- : files(files)
- , id_offset(0){}
-
- template<class T>
- id_type id() const{
- return mpl::at<ids,T>::type::value + this->id_offset;
- }
-
- template<class T>
- olog &operator<<(T const &t){
- id_type const tid=this->id<T>();
- static std::size_t const size=sizeof(tid) + sizeof(t);
- unsigned char data[size];
- std::memcpy(data,&tid,sizeof(tid));
- std::memcpy(data+sizeof(tid),&t,sizeof(t));
- this->files.save_binary(data,mpl::size_t<size>());
- return *this;
- }
- struct archive{
- explicit archive(olog &log) : log(log){}
- template<class T>
- archive &operator<<(T const &t){
- this->log.files << t;
- return *this;
- }
- template<class T>
- archive &operator&(T const &t){ return this->operator<<(t); }
- template<class Size>
- void save_binary(void const *data,Size size){
- this->log.files.save_binary(data,size);
- }
- typedef mpl::true_ is_saving;
- typedef mpl::false_ is_loading;
- private:
- olog &log;
- };
+ typedef unsigned char id_type;
+ explicit olog(olog_files<Sync> &files)
+ : files(files)
+ , id_offset(0){}
+
+ template<class T>
+ id_type id() const{
+ return mpl::at<ids,T>::type::value + this->id_offset;
+ }
+
+ template<class T>
+ olog &operator<<(T const &t){
+ id_type const tid=this->id<T>();
+ static std::size_t const size=sizeof(tid) + sizeof(t);
+ unsigned char data[size];
+ std::memcpy(data,&tid,sizeof(tid));
+ std::memcpy(data+sizeof(tid),&t,sizeof(t));
+ this->files.save_binary(data,mpl::size_t<size>());
+ return *this;
+ }
+ struct archive{
+ explicit archive(olog &log) : log(log){}
+ template<class T>
+ archive &operator<<(T const &t){
+ this->log.files << t;
+ return *this;
+ }
+ template<class T>
+ archive &operator&(T const &t){ return this->operator<<(t); }
+ template<class Size>
+ void save_binary(void const *data,Size size){
+ this->log.files.save_binary(data,size);
+ }
+ typedef mpl::true_ is_saving;
+ typedef mpl::false_ is_loading;
+ private:
+ olog &log;
+ };
 private:
- olog_files<Sync> &files;
- id_type id_offset;
+ olog_files<Sync> &files;
+ id_type id_offset;
 };
 
 template<class Log,class Lockable,std::size_t Size>
 class olog_buffer{
 public:
- typedef typename Log::id_type id_type;
- olog_buffer(Log &log,Lockable &lockable)
- : log(log), lockable(lockable){}
- template<class T>
- olog_buffer &operator<<(T const &t){
- static std::size_t const size=sizeof(id_type) + sizeof(T);
- BOOST_STATIC_ASSERT(size <= Size);
- id_type const id=this->log.template id<T>();
-
- if(this->buffer.size() + size > this->buffer.max_size()) this->flush();
- this->buffer.push_back(reinterpret_cast<char const *>(&id),mpl::size_t<sizeof(id_type)>());
- this->buffer.push_back(reinterpret_cast<char const *>(&t),mpl::size_t<sizeof(T)>());
- return *this;
- }
- struct archive{
- explicit archive(olog_buffer &log) : log(log){}
- template<class T>
- archive &operator<<(T const &t){
- this->save_binary(&t,mpl::size_t<sizeof(T)>());
- return *this;
- }
- template<class T>
- archive &operator&(T const &t){ return this->operator<<(t); }
- template<class S>
- void save_binary(void const *data,S size){
- if(this->log.buffer.size() + size > this->log.buffer.max_size()){
- if(size > Size){
- this->log.flush_and_write(data,size);
- return;
- }else{
- this->log.flush();
- }
- }
- this->log.buffer.push_back(static_cast<char const *>(data),size);
- }
- typedef mpl::true_ is_saving;
- typedef mpl::false_ is_loading;
- private:
- olog_buffer &log;
- };
+ typedef typename Log::id_type id_type;
+ olog_buffer(Log &log,Lockable &lockable)
+ : log(log), lockable(lockable){}
+ template<class T>
+ olog_buffer &operator<<(T const &t){
+ static std::size_t const size=sizeof(id_type) + sizeof(T);
+ BOOST_STATIC_ASSERT(size <= Size);
+ id_type const id=this->log.template id<T>();
+
+ if(this->buffer.size() + size > this->buffer.max_size()) this->flush();
+ this->buffer.push_back(reinterpret_cast<char const *>(&id),mpl::size_t<sizeof(id_type)>());
+ this->buffer.push_back(reinterpret_cast<char const *>(&t),mpl::size_t<sizeof(T)>());
+ return *this;
+ }
+ struct archive{
+ explicit archive(olog_buffer &log) : log(log){}
+ template<class T>
+ archive &operator<<(T const &t){
+ this->save_binary(&t,mpl::size_t<sizeof(T)>());
+ return *this;
+ }
+ template<class T>
+ archive &operator&(T const &t){ return this->operator<<(t); }
+ template<class S>
+ void save_binary(void const *data,S size){
+ if(this->log.buffer.size() + size > this->log.buffer.max_size()){
+ if(size > Size){
+ this->log.flush_and_write(data,size);
+ return;
+ }else{
+ this->log.flush();
+ }
+ }
+ this->log.buffer.push_back(static_cast<char const *>(data),size);
+ }
+ typedef mpl::true_ is_saving;
+ typedef mpl::false_ is_loading;
+ private:
+ olog_buffer &log;
+ };
 private:
- friend struct archive;
+ friend struct archive;
 
- void flush(){
- if(!this->buffer.empty()){
- typename Log::archive ar(this->log);
- {
- lock_guard<Lockable> l(this->lockable);
- ar.save_binary(&this->buffer[0],this->buffer.size());
- }
- this->buffer.clear();
- }
- }
- template<class S>
- void flush_and_write(void const *data,S size){
- typename Log::archive ar(this->log);
- lock_guard<Lockable> l(this->lockable);
- if(!this->buffer.empty()){
- ar.save_binary(&this->buffer[0],this->buffer.size());
- this->buffer.clear();
- }
- ar.save_binary(data,size);
- }
-
-
- Log &log;
- Lockable &lockable;
- detail::embedded_vector<char,Size,false> buffer;
+ void flush(){
+ if(!this->buffer.empty()){
+ typename Log::archive ar(this->log);
+ {
+ lock_guard<Lockable> l(this->lockable);
+ ar.save_binary(&this->buffer[0],this->buffer.size());
+ }
+ this->buffer.clear();
+ }
+ }
+ template<class S>
+ void flush_and_write(void const *data,S size){
+ typename Log::archive ar(this->log);
+ lock_guard<Lockable> l(this->lockable);
+ if(!this->buffer.empty()){
+ ar.save_binary(&this->buffer[0],this->buffer.size());
+ this->buffer.clear();
+ }
+ ar.save_binary(data,size);
+ }
+
+
+ Log &log;
+ Lockable &lockable;
+ detail::embedded_vector<char,Size,false> buffer;
 };
 
 

Modified: sandbox/transaction/boost/transact/simple_transaction_manager.hpp
==============================================================================
--- sandbox/transaction/boost/transact/simple_transaction_manager.hpp (original)
+++ sandbox/transaction/boost/transact/simple_transaction_manager.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -28,112 +28,112 @@
 template<class Resource,bool Threads=true>
 class simple_transaction_manager : noncopyable{
 private:
- struct detail{
- class transaction;
- class transaction_construct_t{
- explicit transaction_construct_t(transaction *parent)
- : parent(parent){}
- friend class simple_transaction_manager;
- friend class transaction;
- transaction *parent;
- };
-
- class transaction : noncopyable{
- public:
- explicit transaction(transaction_construct_t const &c)
- : parent(c.parent){
- if(res){
- if(this->parent){
- this->rtx=in_place(res->begin_nested_transaction(*this->parent->rtx));
- }else{
- this->rtx=in_place(res->begin_root_transaction());
- }
- }
- }
- private:
- friend class simple_transaction_manager;
- optional<typename Resource::transaction> rtx;
- transaction * const parent;
- };
- };
- struct activetx_tag{};
- typedef transact::detail::static_thread_specific_ptr<
- typename detail::transaction,
- activetx_tag,
- Threads> activetx;
- /// \endcond
+ struct detail{
+ class transaction;
+ class transaction_construct_t{
+ explicit transaction_construct_t(transaction *parent)
+ : parent(parent){}
+ friend class simple_transaction_manager;
+ friend class transaction;
+ transaction *parent;
+ };
+
+ class transaction : noncopyable{
+ public:
+ explicit transaction(transaction_construct_t const &c)
+ : parent(c.parent){
+ if(res){
+ if(this->parent){
+ this->rtx=in_place(res->begin_nested_transaction(*this->parent->rtx));
+ }else{
+ this->rtx=in_place(res->begin_root_transaction());
+ }
+ }
+ }
+ private:
+ friend class simple_transaction_manager;
+ optional<typename Resource::transaction> rtx;
+ transaction * const parent;
+ };
+ };
+ struct activetx_tag{};
+ typedef transact::detail::static_thread_specific_ptr<
+ typename detail::transaction,
+ activetx_tag,
+ Threads> activetx;
+ /// \endcond
 public:
- typedef typename detail::transaction transaction;
- typedef mpl::vector<Resource> resource_types;
- template<class ServiceTag>
- struct default_resource{
- typedef typename Resource::tag type;
- };
-
- /// \brief Constructs a simple_transaction_manager
- simple_transaction_manager(){}
-
- /// TODO doc, not part of the concept
- static void connect_resource(Resource &newres){
- if(res) throw resource_error();
- res=&newres;
- }
-
- /// TODO doc, not part of the concept
- static void disconnect_resource(typename Resource::tag tag=typename Resource::tag()){
- res=0;
- }
-
- static Resource &resource(typename Resource::tag tag=typename Resource::tag()){
- if(res) return *res;
- else throw resource_error();
- }
-
- static typename Resource::transaction &
- resource_transaction(transaction &tx,typename Resource::tag tag=typename Resource::tag()){
- if(tx.rtx) return *tx.rtx;
- else throw resource_error();
- }
-
- static typename detail::transaction_construct_t begin_transaction(){
- return typename detail::transaction_construct_t(activetx::get());
- }
-
- static void commit_transaction(transaction &tx){
- bind_transaction(tx);
- if(res){
- BOOST_ASSERT(tx.rtx);
- res->finish_transaction(*tx.rtx);
- res->commit_transaction(*tx.rtx);
- }
- }
-
- static void rollback_transaction(transaction &tx){
- bind_transaction(tx);
- if(res){
- BOOST_ASSERT(tx.rtx);
- res->rollback_transaction(*tx.rtx);
- }
- }
-
- static void bind_transaction(transaction &tx){
- activetx::reset(&tx);
- }
- static void unbind_transaction(){
- activetx::reset(0);
- }
- static transaction &active_transaction(){
- if(transaction *tx=activetx::get()) return *tx;
- else throw no_active_transaction();
- }
- static bool has_active_transaction(){
- return activetx::get() ? true : false;
- }
+ typedef typename detail::transaction transaction;
+ typedef mpl::vector<Resource> resource_types;
+ template<class ServiceTag>
+ struct default_resource{
+ typedef typename Resource::tag type;
+ };
+
+ /// \brief Constructs a simple_transaction_manager
+ simple_transaction_manager(){}
+
+ /// TODO doc, not part of the concept
+ static void connect_resource(Resource &newres){
+ if(res) throw resource_error();
+ res=&newres;
+ }
+
+ /// TODO doc, not part of the concept
+ static void disconnect_resource(typename Resource::tag tag=typename Resource::tag()){
+ res=0;
+ }
+
+ static Resource &resource(typename Resource::tag tag=typename Resource::tag()){
+ if(res) return *res;
+ else throw resource_error();
+ }
+
+ static typename Resource::transaction &
+ resource_transaction(transaction &tx,typename Resource::tag tag=typename Resource::tag()){
+ if(tx.rtx) return *tx.rtx;
+ else throw resource_error();
+ }
+
+ static typename detail::transaction_construct_t begin_transaction(){
+ return typename detail::transaction_construct_t(activetx::get());
+ }
+
+ static void commit_transaction(transaction &tx){
+ bind_transaction(tx);
+ if(res){
+ BOOST_ASSERT(tx.rtx);
+ res->finish_transaction(*tx.rtx);
+ res->commit_transaction(*tx.rtx);
+ }
+ }
+
+ static void rollback_transaction(transaction &tx){
+ bind_transaction(tx);
+ if(res){
+ BOOST_ASSERT(tx.rtx);
+ res->rollback_transaction(*tx.rtx);
+ }
+ }
+
+ static void bind_transaction(transaction &tx){
+ activetx::reset(&tx);
+ }
+ static void unbind_transaction(){
+ activetx::reset(0);
+ }
+ static transaction &active_transaction(){
+ if(transaction *tx=activetx::get()) return *tx;
+ else throw no_active_transaction();
+ }
+ static bool has_active_transaction(){
+ return activetx::get() ? true : false;
+ }
 
- /// \cond
+ /// \cond
 private:
- static Resource *res;
- /// \endcond
+ static Resource *res;
+ /// \endcond
 };
 
 template<class Res,bool Thr>

Modified: sandbox/transaction/boost/transact/transaction.hpp
==============================================================================
--- sandbox/transaction/boost/transact/transaction.hpp (original)
+++ sandbox/transaction/boost/transact/transaction.hpp 2010-03-28 15:01:40 EDT (Sun, 28 Mar 2010)
@@ -22,21 +22,21 @@
 }
 
 #define BOOST_TRANSACT_BEGIN_TRANSACTION \
- BOOST_TRANSACT_BASIC_BEGIN_TRANSACTION(boost::transact::transaction_manager)
+ BOOST_TRANSACT_BASIC_BEGIN_TRANSACTION(boost::transact::transaction_manager)
 
 #define BOOST_TRANSACT_RETRY \
- BOOST_TRANSACT_BASIC_RETRY(boost::transact::transaction_manager)
+ BOOST_TRANSACT_BASIC_RETRY(boost::transact::transaction_manager)
 
 #define BOOST_TRANSACT_END_RETRY \
- BOOST_TRANSACT_BASIC_END_RETRY(boost::transact::transaction_manager)
+ BOOST_TRANSACT_BASIC_END_RETRY(boost::transact::transaction_manager)
 
 #define BOOST_TRANSACT_END_RETRY_IN_LOOP \
- BOOST_TRANSACT_BASIC_END_RETRY_IN_LOOP(boost::transact::transaction_manager)
+ BOOST_TRANSACT_BASIC_END_RETRY_IN_LOOP(boost::transact::transaction_manager)
 
 #define BOOST_TRANSACT_END_TRANSACTION \
- BOOST_TRANSACT_BASIC_END_TRANSACTION(boost::transact::transaction_manager)
+ BOOST_TRANSACT_BASIC_END_TRANSACTION(boost::transact::transaction_manager)
 
 #define BOOST_TRANSACT_END_TRANSACTION_IN_LOOP \
- BOOST_TRANSACT_BASIC_END_TRANSACTION_IN_LOOP(boost::transact::transaction_manager)
+ BOOST_TRANSACT_BASIC_END_TRANSACTION_IN_LOOP(boost::transact::transaction_manager)
 
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk