-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for key-value pair IR format serialization and dese…
…rialization. (#86) Co-authored-by: kirkrodrigues <[email protected]>
- Loading branch information
1 parent
81ecf85
commit 2b8c23f
Showing
45 changed files
with
3,581 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "pr-title-checks" | ||
|
||
on: | ||
pull_request_target: | ||
types: ["edited", "opened", "reopened"] | ||
branches: ["main"] | ||
|
||
permissions: | ||
pull-requests: "read" | ||
|
||
concurrency: | ||
group: "${{github.workflow}}-${{github.ref}}" | ||
|
||
# Cancel in-progress jobs for efficiency | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
conventional-commits: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "amannn/action-semantic-pull-request@v5" | ||
env: | ||
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[submodule "src/clp"] | ||
path = src/clp | ||
url = https://github.com/y-scope/clp.git | ||
[submodule "src/msgpack"] | ||
path = src/msgpack | ||
url = https://github.com/msgpack/msgpack-c | ||
[submodule "src/GSL"] | ||
path = src/GSL | ||
url = https://github.com/microsoft/GSL.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule clp
updated
3 files
+22 −0 | components/core/cmake/Modules/FindMariaDBClient.cmake | |
+31 −49 | components/core/src/clp/ffi/KeyValuePairLogEvent.cpp | |
+12 −0 | components/core/src/clp/ffi/KeyValuePairLogEvent.hpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#ifndef CLP_FFI_PY_PYEXCEPTIONCONTEXT_HPP | ||
#define CLP_FFI_PY_PYEXCEPTIONCONTEXT_HPP | ||
|
||
#include <clp_ffi_py/Python.hpp> // Must always be included before any other header files | ||
|
||
namespace clp_ffi_py { | ||
/** | ||
* Class to get/set Python exception context, designed to capture the current exception state upon | ||
* instantiation and provide a restore API that allows users to reinstate the exception context when | ||
* needed. Doc: https://docs.python.org/3/c-api/exceptions.html#c.PyErr_Fetch | ||
*/ | ||
class PyExceptionContext { | ||
public: | ||
// Constructor | ||
/** | ||
* Constructs the context by fetching the current raised exception (if any). | ||
*/ | ||
PyExceptionContext() { PyErr_Fetch(&m_type, &m_value, &m_traceback); } | ||
|
||
// Delete copy/move constructors and assignments | ||
PyExceptionContext(PyExceptionContext const&) = delete; | ||
PyExceptionContext(PyExceptionContext&&) = delete; | ||
auto operator=(PyExceptionContext const&) -> PyExceptionContext& = delete; | ||
auto operator=(PyExceptionContext&&) -> PyExceptionContext& = delete; | ||
|
||
// Destructor | ||
~PyExceptionContext() { | ||
Py_XDECREF(m_type); | ||
Py_XDECREF(m_value); | ||
Py_XDECREF(m_traceback); | ||
} | ||
|
||
// Methods | ||
/** | ||
* @return Whether the context stores an exception. | ||
*/ | ||
[[nodiscard]] auto has_exception() const noexcept -> bool { return nullptr != m_value; } | ||
|
||
/** | ||
* Restores the exception from the context. | ||
* NOTE: | ||
* - This method will clear the existing exception if one is set. | ||
* - The stored context will be cleared after restoration. | ||
* - If there's no exception in the stored context, the error indicator will be cleared. | ||
* - This method should be called strictly once, otherwise the error indicator will be cleared. | ||
* @return Whether an exception has been set by restoring the context. | ||
*/ | ||
[[maybe_unused]] auto restore() noexcept -> bool { | ||
auto const exception_has_been_set{has_exception()}; | ||
PyErr_Restore(m_type, m_value, m_traceback); | ||
m_type = nullptr; | ||
m_value = nullptr; | ||
m_traceback = nullptr; | ||
return exception_has_been_set; | ||
} | ||
|
||
[[nodiscard]] auto get_type() const -> PyObject* { return m_type; } | ||
|
||
[[nodiscard]] auto get_value() const -> PyObject* { return m_value; } | ||
|
||
[[nodiscard]] auto get_traceback() const -> PyObject* { return m_traceback; } | ||
|
||
private: | ||
PyObject* m_type{nullptr}; | ||
PyObject* m_value{nullptr}; | ||
PyObject* m_traceback{nullptr}; | ||
}; | ||
} // namespace clp_ffi_py | ||
|
||
#endif // CLP_FFI_PY_PYEXCEPTIONCONTEXT_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.