@@ -90,6 +90,40 @@ PYBIND11_MODULE(dtlmod, m)
9090
9191 py::register_exception<dtlmod::TransactionCancelledException>(m, " TransactionCancelledException" );
9292
93+ /* Class Engine */
94+ py::class_<Engine, std::shared_ptr<Engine>> engine (
95+ m, " Engine" , " An Engine defines how data is transferred between the applications and the DTL" );
96+ engine.def_property_readonly (" name" , &Engine::get_name, " The name of the Engine (read-only)" )
97+ .def (" begin_transaction" , &Engine::begin_transaction, py::call_guard<py::gil_scoped_release>(),
98+ " Begin a transaction on this Engine" )
99+ .def (" put" , py::overload_cast<const std::shared_ptr<Variable>&>(&Engine::put, py::const_), py::arg (" var" ),
100+ py::call_guard<py::gil_scoped_release>(), " Put a Variable in the DTL using this Engine" )
101+ .def (" put" , py::overload_cast<const std::shared_ptr<Variable>&, size_t >(&Engine::put, py::const_), py::arg (" var" ),
102+ py::arg (" simulated_size_in_bytes" ), py::call_guard<py::gil_scoped_release>(),
103+ " Put a Variable in the DTL using this Engine" )
104+ .def (" get" , &Engine::get, py::arg (" var" ), py::call_guard<py::gil_scoped_release>(),
105+ " Get a Variable from the DTL using this Engine" )
106+ .def (" end_transaction" , &Engine::end_transaction, py::call_guard<py::gil_scoped_release>(),
107+ " End a transaction on this Engine" )
108+ .def_property_readonly (" current_transaction" , &Engine::get_current_transaction,
109+ " The id of the current transaction on this Engine (read-only)" )
110+ .def (" cancel_transaction" , &Engine::cancel_transaction, py::call_guard<py::gil_scoped_release>(),
111+ " Cancel all in-flight activities of the current transaction (must be called from an external actor)" )
112+ .def (" close" , &Engine::close, py::call_guard<py::gil_scoped_release>(), " Close this Engine" );
113+
114+ py::enum_<Engine::Type>(engine, " Type" , " The type of Engine" )
115+ .value (" Undefined" , Engine::Type::Undefined)
116+ .value (" Staging" , Engine::Type::Staging)
117+ .value (" File" , Engine::Type::File);
118+
119+ /* Class Transport */
120+ py::class_<Transport> transport (m, " Transport" , " The transport method used by an Engine to transfer data" );
121+ py::enum_<Transport::Method>(transport, " Method" , " The transport method used by the Engine" )
122+ .value (" Undefined" , Transport::Method::Undefined)
123+ .value (" MQ" , Transport::Method::MQ )
124+ .value (" Mailbox" , Transport::Method::Mailbox)
125+ .value (" File" , Transport::Method::File);
126+
93127 /* Class DTL */
94128 py::class_<DTL , std::shared_ptr<DTL >>(m, " DTL" , " Data Transport Layer" )
95129 .def_static (" create" , py::overload_cast<std::string_view>(&DTL ::create), py::call_guard<py::gil_scoped_release>(),
@@ -218,38 +252,4 @@ PYBIND11_MODULE(dtlmod, m)
218252 " Get the flop cost to reduce a Variable" )
219253 .def (" get_flop_amount_to_decompress_variable" , &ReductionMethod::get_flop_amount_to_decompress_variable,
220254 py::arg (" var" ), " Get the flop cost to decompress a Variable" );
221-
222- /* Class Engine */
223- py::class_<Engine, std::shared_ptr<Engine>> engine (
224- m, " Engine" , " An Engine defines how data is transferred between the applications and the DTL" );
225- engine.def_property_readonly (" name" , &Engine::get_name, " The name of the Engine (read-only)" )
226- .def (" begin_transaction" , &Engine::begin_transaction, py::call_guard<py::gil_scoped_release>(),
227- " Begin a transaction on this Engine" )
228- .def (" put" , py::overload_cast<const std::shared_ptr<Variable>&>(&Engine::put, py::const_), py::arg (" var" ),
229- py::call_guard<py::gil_scoped_release>(), " Put a Variable in the DTL using this Engine" )
230- .def (" put" , py::overload_cast<const std::shared_ptr<Variable>&, size_t >(&Engine::put, py::const_), py::arg (" var" ),
231- py::arg (" simulated_size_in_bytes" ), py::call_guard<py::gil_scoped_release>(),
232- " Put a Variable in the DTL using this Engine" )
233- .def (" get" , &Engine::get, py::arg (" var" ), py::call_guard<py::gil_scoped_release>(),
234- " Get a Variable from the DTL using this Engine" )
235- .def (" end_transaction" , &Engine::end_transaction, py::call_guard<py::gil_scoped_release>(),
236- " End a transaction on this Engine" )
237- .def_property_readonly (" current_transaction" , &Engine::get_current_transaction,
238- " The id of the current transaction on this Engine (read-only)" )
239- .def (" cancel_transaction" , &Engine::cancel_transaction, py::call_guard<py::gil_scoped_release>(),
240- " Cancel all in-flight activities of the current transaction (must be called from an external actor)" )
241- .def (" close" , &Engine::close, py::call_guard<py::gil_scoped_release>(), " Close this Engine" );
242-
243- py::enum_<Engine::Type>(engine, " Type" , " The type of Engine" )
244- .value (" Undefined" , Engine::Type::Undefined)
245- .value (" Staging" , Engine::Type::Staging)
246- .value (" File" , Engine::Type::File);
247-
248- /* Class Transport */
249- py::class_<Transport> transport (m, " Transport" , " The transport method used by an Engine to transfer data" );
250- py::enum_<Transport::Method>(transport, " Method" , " The transport method used by the Engine" )
251- .value (" Undefined" , Transport::Method::Undefined)
252- .value (" MQ" , Transport::Method::MQ )
253- .value (" Mailbox" , Transport::Method::Mailbox)
254- .value (" File" , Transport::Method::File);
255255}
0 commit comments