1
0
mirror of https://github.com/apple/foundationdb.git synced 2025-05-22 06:40:01 +08:00

Update ISingleThreadTransaction::create to support PAXOS_CONFIG transactions

This commit is contained in:
sfc-gh-tclinkenbeard 2021-05-17 13:15:40 -07:00
parent ba8d21e340
commit da2f773759
3 changed files with 10 additions and 0 deletions

@ -18,6 +18,8 @@
* limitations under the License.
*/
#pragma once
#include <memory>
#include "fdbclient/ConfigKnobs.h"

@ -20,6 +20,7 @@
#include "fdbclient/DatabaseContext.h"
#include "fdbclient/ISingleThreadTransaction.h"
#include "fdbclient/PaxosConfigTransaction.h"
#include "fdbclient/ReadYourWrites.h"
#include "fdbclient/SimpleConfigTransaction.h"
@ -32,6 +33,9 @@ ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type
} else if (type == Type::SIMPLE_CONFIG) {
auto tr = (SimpleConfigTransaction*)(SimpleConfigTransaction::operator new(sizeof(SimpleConfigTransaction)));
return tr;
} else if (type == Type::PAXOS_CONFIG) {
auto tr = (PaxosConfigTransaction*)(PaxosConfigTransaction::operator new(sizeof(PaxosConfigTransaction)));
return tr;
}
ASSERT(false);
return nullptr;
@ -45,6 +49,9 @@ void ISingleThreadTransaction::create(ISingleThreadTransaction* tr, Type type, D
case Type::SIMPLE_CONFIG:
new (tr) SimpleConfigTransaction(db->getConnectionFile()->getConnectionString());
break;
case Type::PAXOS_CONFIG:
new (tr) PaxosConfigTransaction(db->getConnectionFile()->getConnectionString());
break;
default:
ASSERT(false);
}

@ -37,6 +37,7 @@ public:
enum class Type {
RYW,
SIMPLE_CONFIG,
PAXOS_CONFIG,
};
static ISingleThreadTransaction* allocateOnForeignThread(Type type);