Skip to content

Commit

Permalink
Merge pull request #417 from ApexAI/iox-#91-minor-roudi-cleanups
Browse files Browse the repository at this point in the history
Iox #91 Clean up todo's in RouDi classes
  • Loading branch information
mossmaurice authored Dec 16, 2020
2 parents 70e47a5 + 4892c1a commit 5a46538
Show file tree
Hide file tree
Showing 56 changed files with 741 additions and 276 deletions.
11 changes: 7 additions & 4 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ An up to date list of the maintainers can be found at the [Eclipse project page]

## Bi-weekly meetup

Bi-weekly every Thursday for 1 hour. Everyone is welcome to join.
Bi-weekly every first and third Thursday for 1 hour. Everyone is welcome to join.

You can join by using this Zoom link: **ADD LINK HERE**
You can join by using this Zoom link: https://eclipse.zoom.us/j/95918504483?pwd=RWM5Y1pkeStKVDZsU09EY1hnclREUT09

```
08:00 PST (GMT - 8)
Expand Down Expand Up @@ -51,8 +51,11 @@ If you have points that you want to discuss, please send your points to the [mai
```
# Eclipse iceoryx developer meetup
Date: 1st January 1900
Time: 17:00 CET
**Date:** 1900/01/01
**Time:** 17:00 CET
**Link:** https://eclipse.zoom.us/j/95918504483?pwd=RWM5Y1pkeStKVDZsU09EY1hnclREUT09
## Attendees
Expand Down
1 change: 1 addition & 0 deletions iceoryx_dds/include/iceoryx_dds/dds/dds_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace iox
{
namespace dds
{
using namespace units::duration_literals;
static constexpr units::Duration DISCOVERY_PERIOD = 1000_ms;
static constexpr units::Duration FORWARDING_PERIOD = 50_ms;
static constexpr uint32_t SUBSCRIBER_CACHE_SIZE = 128u;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_examples/singleprocess/single_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int main()

iox::roudi::RouDi roudi(roudiComponents.m_rouDiMemoryManager,
roudiComponents.m_portManager,
iox::roudi::RouDi::RoudiStartupParameters{iox::config::MonitoringMode::OFF, false});
iox::roudi::RouDi::RoudiStartupParameters{iox::roudi::MonitoringMode::OFF, false});

// create a single process runtime for inter thread communication
iox::runtime::PoshRuntimeSingleProcess runtime("/singleProcessDemo");
Expand Down
1 change: 1 addition & 0 deletions iceoryx_posh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ add_library(iceoryx_posh_roudi
source/roudi/roudi_lock.cpp
source/roudi/roudi_process.cpp
source/roudi/service_registry.cpp
source/roudi/iceoryx_roudi_components.cpp
)

add_library(${PROJECT_NAMESPACE}::iceoryx_posh_roudi ALIAS iceoryx_posh_roudi)
Expand Down
3 changes: 3 additions & 0 deletions iceoryx_posh/include/iceoryx_posh/gateway/gateway_generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "iceoryx_utils/cxx/string.hpp"
#include "iceoryx_utils/cxx/vector.hpp"
#include "iceoryx_utils/internal/concurrent/smart_lock.hpp"
#include "iceoryx_utils/internal/units/duration.hpp"

#include <atomic>
#include <thread>
Expand All @@ -34,6 +35,8 @@ namespace iox
{
namespace gw
{
using namespace iox::units::duration_literals;

enum class GatewayError : uint8_t
{
UNSUPPORTED_SERVICE_TYPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TomlGatewayConfigParser
{
public:
static cxx::expected<GatewayConfig, TomlGatewayConfigParseError> parse();
static cxx::expected<GatewayConfig, TomlGatewayConfigParseError> parse(const ConfigFilePathString_t& path);
static cxx::expected<GatewayConfig, TomlGatewayConfigParseError> parse(const roudi::ConfigFilePathString_t& path);

protected:
static cxx::expected<TomlGatewayConfigParseError> validate(const cpptoml::table& parsedToml) noexcept;
Expand Down
57 changes: 39 additions & 18 deletions iceoryx_posh/include/iceoryx_posh/iceoryx_posh_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "iceoryx_utils/cxx/variant_queue.hpp"
#include "iceoryx_utils/cxx/vector.hpp"
#include "iceoryx_utils/internal/units/duration.hpp"
#include "iceoryx_utils/log/logstream.hpp"

#include <cstdint>

Expand Down Expand Up @@ -49,8 +50,6 @@ using UniquePortId = popo::TypedUniqueId<popo::BasePortData>;

using SubscriberPortType = iox::build::CommunicationPolicy;

constexpr char MQ_ROUDI_NAME[] = "/roudi";

/// @brief The socket is created in the current path if no absolute path is given hence
/// we need an absolut path so that every application knows where our sockets can
/// be found.
Expand All @@ -60,20 +59,6 @@ using IpcChannelType = iox::posix::UnixDomainSocket;
using IpcChannelType = iox::posix::MessageQueue;
#endif

/// shared memmory segment for the iceoryx managment data
constexpr char SHM_NAME[] = "/iceoryx_mgmt";

// Make the user-defined literal operators accessible
using namespace units::duration_literals;

// Timeout
constexpr units::Duration PROCESS_DEFAULT_KILL_DELAY = 45_s;
constexpr units::Duration PROCESS_TERMINATED_CHECK_INTERVAL = 250_ms;
constexpr units::Duration PROCESS_WAITING_FOR_ROUDI_TIMEOUT = 60_s;
constexpr units::Duration DISCOVERY_INTERVAL = 100_ms;
constexpr units::Duration PROCESS_KEEP_ALIVE_INTERVAL = 3 * DISCOVERY_INTERVAL; // > DISCOVERY_INTERVAL
constexpr units::Duration PROCESS_KEEP_ALIVE_TIMEOUT = 5 * PROCESS_KEEP_ALIVE_INTERVAL; // > PROCESS_KEEP_ALIVE_INTERVAL

/// @todo remove MAX_RECEIVERS_PER_SENDERPORT when the new port building blocks are used
constexpr uint32_t MAX_RECEIVERS_PER_SENDERPORT = build::IOX_MAX_SUBSCRIBERS_PER_PUBLISHER;

Expand Down Expand Up @@ -191,19 +176,53 @@ struct DefaultChunkQueueConfig
};

// alias for cxx::string
using ConfigFilePathString_t = cxx::string<1024>;
using ProcessName_t = cxx::string<MAX_PROCESS_NAME_LENGTH>;
using NodeName_t = cxx::string<100>;
using ShmName_t = cxx::string<128>;

namespace capro
{
using IdString_t = cxx::string<100>;
using IdString_t = cxx::string<100>;
}

/// @todo Move everything in this namespace to iceoryx_roudi_types.hpp once we move RouDi to a separate CMake target
namespace roudi
{
using ConfigFilePathString_t = cxx::string<1024>;

constexpr char MQ_ROUDI_NAME[] = "/roudi";

/// shared memmory segment for the iceoryx managment data
constexpr char SHM_NAME[] = "/iceoryx_mgmt";

// Timeout
using namespace units::duration_literals;
constexpr units::Duration PROCESS_DEFAULT_KILL_DELAY = 45_s;
constexpr units::Duration PROCESS_TERMINATED_CHECK_INTERVAL = 250_ms;
constexpr units::Duration DISCOVERY_INTERVAL = 100_ms;

/// @brief Controls process alive monitoring. Upon timeout, a monitored process is removed
/// and its resources are made available. The process can then start and register itself again.
/// Contrarily, unmonitored processes can be restarted but registration will fail.
/// Once Runlevel Management is extended, it will detect absent processes. Those processes can register again.
/// ON - all processes are monitored
/// OFF - no process is monitored
enum class MonitoringMode
{
ON,
OFF
};

iox::log::LogStream& operator<<(iox::log::LogStream& logstream, const MonitoringMode& mode);
} // namespace roudi

namespace runtime
{
using InstanceContainer = iox::cxx::vector<capro::IdString_t, MAX_NUMBER_OF_INSTANCES>;
using namespace units::duration_literals;
constexpr units::Duration PROCESS_WAITING_FOR_ROUDI_TIMEOUT = 60_s;
constexpr units::Duration PROCESS_KEEP_ALIVE_INTERVAL = 3 * roudi::DISCOVERY_INTERVAL; // > DISCOVERY_INTERVAL
constexpr units::Duration PROCESS_KEEP_ALIVE_TIMEOUT = 5 * PROCESS_KEEP_ALIVE_INTERVAL; // > PROCESS_KEEP_ALIVE_INTERVAL
} // namespace runtime

namespace version
Expand All @@ -216,4 +235,6 @@ using BuildDateString_t = cxx::string<BUILD_DATE_STRING_SIZE>;

} // namespace iox

#include "iceoryx_posh/iceoryx_posh_types.inl"

#endif // IOX_POSH_ICEORYX_POSH_TYPES_HPP
41 changes: 41 additions & 0 deletions iceoryx_posh/include/iceoryx_posh/iceoryx_posh_types.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) 2020 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef IOX_POSH_ICEORYX_POSH_TYPES_INL
#define IOX_POSH_ICEORYX_POSH_TYPES_INL

namespace iox
{
namespace roudi
{
inline iox::log::LogStream& operator<<(iox::log::LogStream& logstream, const MonitoringMode& mode)
{
switch (mode)
{
case MonitoringMode::OFF:
logstream << "MonitoringMode::OFF";
break;
case MonitoringMode::ON:
logstream << "MonitoringMode::ON";
break;
default:
logstream << "MonitoringMode::UNDEFINED";
break;
}
return logstream;
}
} // namespace roudi

} // namespace iox

#endif // IOX_POSH_ICEORYX_POSH_TYPES_INL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2019, 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,7 @@
#ifndef IOX_POSH_ROUDI_INTROSPECTION_MEMPOOL_INTROSPECTION_INL
#define IOX_POSH_ROUDI_INTROSPECTION_MEMPOOL_INTROSPECTION_INL

#include "iceoryx_utils/posix_wrapper/thread.hpp"
#include "mempool_introspection.hpp"

namespace iox
Expand All @@ -30,9 +31,7 @@ MemPoolIntrospection<MemoryManager, SegmentManager, PublisherPort>::MemPoolIntro
{
m_publisherPort.offer();

/// @todo create a wrapper function which takes care of the 16 character limitation of the thread name
// set thread name
pthread_setname_np(m_thread.native_handle(), "MemPoolIntr");
posix::setThreadName(m_thread.native_handle(), "MemPoolIntr");
}

template <typename MemoryManager, typename SegmentManager, typename PublisherPort>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "iceoryx_posh/mepoo/chunk_header.hpp"
#include "iceoryx_posh/roudi/introspection_types.hpp"
#include "iceoryx_utils/cxx/helplets.hpp"
#include "iceoryx_utils/platform/pthread.hpp"
#include "iceoryx_utils/posix_wrapper/thread.hpp"

#include <atomic>
#include <mutex>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2019, 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,8 @@
#ifndef IOX_POSH_ROUDI_INTROSPECTION_PORT_INTROSPECTION_INL
#define IOX_POSH_ROUDI_INTROSPECTION_PORT_INTROSPECTION_INL

#include "iceoryx_utils/posix_wrapper/thread.hpp"

namespace iox
{
namespace roudi
Expand Down Expand Up @@ -99,7 +101,7 @@ void PortIntrospection<PublisherPort, SubscriberPort>::run()
});

// set thread name
pthread_setname_np(m_thread.native_handle(), "PortIntr");
posix::setThreadName(m_thread.native_handle(), "PortIntr");
}

template <typename PublisherPort, typename SubscriberPort>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2019, 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
#include "process_introspection.hpp"

#include "iceoryx_posh/internal/log/posh_logging.hpp"
#include "iceoryx_utils/posix_wrapper/thread.hpp"

#include <chrono>

Expand Down Expand Up @@ -173,7 +174,7 @@ void ProcessIntrospection<PublisherPort>::run()
});

// set thread name
pthread_setname_np(m_thread.native_handle(), "ProcessIntr");
posix::setThreadName(m_thread.native_handle(), "ProcessIntr");
}

template <typename PublisherPort>
Expand Down
8 changes: 4 additions & 4 deletions iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class RouDi
struct RoudiStartupParameters
{
RoudiStartupParameters(
const config::MonitoringMode monitoringMode = config::MonitoringMode::ON,
const roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::ON,
const bool killProcessesInDestructor = true,
const MQThreadStart mqThreadStart = MQThreadStart::IMMEDIATE,
const version::CompatibilityCheckLevel compatibilityCheckLevel = version::CompatibilityCheckLevel::PATCH,
const units::Duration processKillDelay = PROCESS_DEFAULT_KILL_DELAY) noexcept
const units::Duration processKillDelay = roudi::PROCESS_DEFAULT_KILL_DELAY) noexcept
: m_monitoringMode(monitoringMode)
, m_killProcessesInDestructor(killProcessesInDestructor)
, m_mqThreadStart(mqThreadStart)
Expand All @@ -65,7 +65,7 @@ class RouDi
{
}

const config::MonitoringMode m_monitoringMode;
const roudi::MonitoringMode m_monitoringMode;
const bool m_killProcessesInDestructor;
const MQThreadStart m_mqThreadStart;
const version::CompatibilityCheckLevel m_compatibilityCheckLevel;
Expand Down Expand Up @@ -148,7 +148,7 @@ class RouDi
MemPoolIntrospectionType m_mempoolIntrospection;

private:
config::MonitoringMode m_monitoringMode{config::MonitoringMode::ON};
roudi::MonitoringMode m_monitoringMode{roudi::MonitoringMode::ON};
units::Duration m_processKillDelay;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RouDiEnvironment
{
public:
RouDiEnvironment(const RouDiConfig_t& roudiConfig = RouDiConfig_t().setDefaults(),
config::MonitoringMode monitoringMode = config::MonitoringMode::OFF,
roudi::MonitoringMode monitoringMode = roudi::MonitoringMode::OFF,
const uint16_t uniqueRouDiId = 0u);
virtual ~RouDiEnvironment();

Expand Down
5 changes: 3 additions & 2 deletions iceoryx_posh/include/iceoryx_posh/roudi/iceoryx_roudi_app.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2019, 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,8 @@ class IceOryxRouDiApp : public RouDiApp
IceOryxRouDiApp(const config::CmdLineParser& cmdLineParser, const RouDiConfig_t& roudiConfig) noexcept;

/// @brief starts the execution of the RouDi daemon
void run() noexcept override;
/// @return Return code for programm execution
uint8_t run() noexcept override;
};

} // namespace roudi
Expand Down
Loading

0 comments on commit 5a46538

Please sign in to comment.