Exceptions: All of smocore likely now uses exceptions

This commit is contained in:
2026-06-07 19:37:50 -04:00
parent 241e8a6798
commit b2644f17c6
8 changed files with 304 additions and 242 deletions
+12 -19
View File
@@ -13,8 +13,8 @@
#include <deviceManager/deviceRole.h>
#include <deviceManager/deviceReattacher.h>
#include <marionette/marionetteThread.h>
#include <spinscale/co/coQutex.h>
#include <spinscale/multiOperationResultSet.h>
#include <spinscale/co/coQutex.h>
#include <spinscale/sharedResourceGroup.h>
namespace smo {
@@ -25,13 +25,6 @@ class DeviceReattacher;
class DeviceManager
{
public:
struct DeviceAttachmentIndResult
{
bool success = false;
std::shared_ptr<DeviceRole> deviceRole;
std::shared_ptr<DeviceAttachmentSpec> deviceSpec;
};
static DeviceManager& getInstance()
{
static DeviceManager instance;
@@ -52,31 +45,27 @@ public:
static const std::string stringifyDeviceSpecs(void);
mrntt::MrnttViralPostingInvoker<DeviceAttachmentIndResult>
mrntt::MrnttViralPostingInvoker<std::shared_ptr<DeviceRole>>
newDeviceAttachmentSpecIndCReq(const DeviceAttachmentSpec &spec);
mrntt::MrnttViralPostingInvoker<DeviceAttachmentIndResult>
mrntt::MrnttViralPostingInvoker<void>
removeDeviceAttachmentSpecCReq(const DeviceAttachmentSpec &spec);
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>
mrntt::MrnttViralPostingInvoker<void>
attachStimBuffDeviceCReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec);
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>
mrntt::MrnttViralPostingInvoker<void>
detachStimBuffDeviceCReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec);
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
attachAllUnattachedDevicesFromCReq(
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs);
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
mrntt::MrnttViralPostingInvoker<void>
attachAllUnattachedDevicesFromKnownListCReq();
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
mrntt::MrnttViralPostingInvoker<void>
attachAllUnattachedDevicesFromCmdlineCReq();
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
mrntt::MrnttViralPostingInvoker<void>
detachAllAttachedDeviceRolesCReq();
private:
@@ -88,6 +77,10 @@ private:
DeviceManager(const DeviceManager&) = delete;
DeviceManager& operator=(const DeviceManager&) = delete;
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSetWithException>
attachAllUnattachedDevicesFromCReq(
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs);
public:
struct Resources
{
@@ -9,7 +9,6 @@
#include <optional>
#include <boost/asio/deadline_timer.hpp>
#include <marionette/marionetteThread.h>
#include <spinscale/multiOperationResultSet.h>
#include <spinscale/syncCancelerForAsyncWork.h>
namespace smo {
@@ -37,17 +36,17 @@ private:
void onTimeout(const boost::system::error_code& error);
void holdReattachCReq();
mrntt::MrnttNonViralPostingInvoker reattachKnownListCReq(
sscl::co::ExplicitPostTarget postTarget,
mrntt::MrnttNonViralNonPostingInvoker reattachKnownListCReq(
std::exception_ptr &exceptionPtr,
std::function<void()> callback);
DeviceManager &parent;
// io_context thread for timer and non-posting reattach shell (see ctor).
std::shared_ptr<sscl::ComponentThread> ioThread;
sscl::SyncCancelerForAsyncWork deviceReattacherCanceler;
boost::asio::deadline_timer timer;
std::exception_ptr reattachLifetimeExceptionPtr;
std::optional<mrntt::MrnttNonViralPostingInvoker> reattachCReqInvoker;
std::optional<mrntt::MrnttNonViralNonPostingInvoker> reattachCReqInvoker;
bool reattachOpInFlight = false;
std::chrono::steady_clock::time_point lastReattachReqTimestamp{};
};