Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add meta proto service for service discovery #543

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

oguzcanoguz
Copy link
Contributor

No description provided.

@oguzcanoguz oguzcanoguz requested a review from a team as a code owner January 25, 2024 14:40
Copy link
Contributor

github-actions bot commented Jan 25, 2024

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

osal/threadx/CMakeLists.txt

PackageVersionLicenseIssue Type
eclipse-threadx/threadx07eac307405dbf09d409844e31c37b0649d6c074NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
unknown/eclipse-threadx/threadx 07eac307405dbf09d409844e31c37b0649d6c074 UnknownUnknown
unknown/azure-rtos/threadx e11c166a4045d80ea74fe917e5608474754f5067 UnknownUnknown

Scanned Manifest Files

osal/threadx/CMakeLists.txt

Copy link
Contributor

github-actions bot commented Jan 25, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 12 0 0.07s
✅ CPP clang-format 970 7 0 7.48s
✅ DOCKERFILE hadolint 2 0 0.11s
✅ JSON jsonlint 9 0 0.19s
✅ JSON prettier 9 0 0 0.92s
⚠️ MARKDOWN markdownlint 6 0 4 1.61s
⚠️ MARKDOWN markdown-link-check 6 2 59.19s
✅ MARKDOWN markdown-table-formatter 6 0 0 0.38s
✅ REPOSITORY checkov yes no 22.23s
✅ REPOSITORY git_diff yes no 0.05s
✅ REPOSITORY grype yes no 18.21s
✅ REPOSITORY secretlint yes no 8.28s
✅ REPOSITORY trivy yes no 11.86s
✅ REPOSITORY trivy-sbom yes no 0.73s
✅ REPOSITORY trufflehog yes no 3.05s
⚠️ SPELL lychee 139 6 2.87s
⚠️ YAML prettier 22 0 1 1.36s
✅ YAML v8r 22 0 12.38s
✅ YAML yamllint 22 0 0.47s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

protobuf/meta_services/ServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
protobuf/meta_services/ServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
protobuf/meta_services/ServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
protobuf/meta_services/ServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
protobuf/meta_services/test/TestServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
protobuf/meta_services/test/TestServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
protobuf/meta_services/test/TestServiceDiscoveryEcho.cpp Outdated Show resolved Hide resolved
oguzcanoguz and others added 9 commits January 25, 2024 15:55
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@oguzcanoguz oguzcanoguz reopened this Jan 26, 2024
@oguzcanoguz oguzcanoguz marked this pull request as draft January 26, 2024 14:06
Copy link

sonarcloud bot commented Jan 26, 2024

@richardapeters richardapeters changed the title feat: Add meta proto service for service discovery feat: add meta proto service for service discovery Feb 21, 2024
Comment on lines +32 to +33
return service_discovery::ServiceDiscovery::AcceptsService(serviceId)
|| IsProxyServiceSupported(serviceId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
return service_discovery::ServiceDiscovery::AcceptsService(serviceId)
|| IsProxyServiceSupported(serviceId);
return service_discovery::ServiceDiscovery::AcceptsService(serviceId) || IsProxyServiceSupported(serviceId);

virtual ~ServiceDiscoveryEcho() = default;

void FindFirstServiceInRange(uint32_t startServiceId, uint32_t endServiceId) override;
void NotifyServiceChanges(bool value) override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
void NotifyServiceChanges(bool value) override
void NotifyServiceChanges(bool value) override

{}

bool AcceptsService(uint32_t id) const override;
//infra::SharedPtr<services::MethodDeserializer> StartMethod(uint32_t serviceId, uint32_t methodId, uint32_t size, const services::EchoErrorPolicy& errorPolicy) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
//infra::SharedPtr<services::MethodDeserializer> StartMethod(uint32_t serviceId, uint32_t methodId, uint32_t size, const services::EchoErrorPolicy& errorPolicy) override;
// infra::SharedPtr<services::MethodDeserializer> StartMethod(uint32_t serviceId, uint32_t methodId, uint32_t size, const services::EchoErrorPolicy& errorPolicy) override;

}

protected:
bool IsProxyServiceSupported(uint32_t& serviceId) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
bool IsProxyServiceSupported(uint32_t& serviceId) const;
bool IsProxyServiceSupported(uint32_t& serviceId) const;

void ServiceDiscoveryEcho::NotifyServiceChanges(bool value)
{
notifyServiceChanges = value;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

auto startMethodArgs = std::tie(serviceId, methodId, size, errorPolicy);
NotifyObservers([&methodSerializer, &startMethodArgs](auto& obs)
{
if(obs.AcceptsService(std::get<0>(startMethodArgs)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
if(obs.AcceptsService(std::get<0>(startMethodArgs)))
if (obs.AcceptsService(std::get<0>(startMethodArgs)))

void ServiceDiscoveryEcho::RegisterObserver(infra::Observer<Service, Echo>* observer)
{
services::Echo::RegisterObserver(observer);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

void ServiceDiscoveryEcho::UnregisterObserver(infra::Observer<Service, Echo>* observer)
{
services::Echo::UnregisterObserver(observer);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change


virtual ~ServiceDiscoveryEcho() = default;

//Implementation of services::ServiceDiscovery
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
//Implementation of services::ServiceDiscovery
// Implementation of services::ServiceDiscovery

Comment on lines 59 to 61
{
proxy.FindFirstServiceInRange(startServiceId, endServiceId);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
{
proxy.FindFirstServiceInRange(startServiceId, endServiceId);
});
{
proxy.FindFirstServiceInRange(startServiceId, endServiceId);
});

Comment on lines 67 to 69
{
proxy.NotifyServiceChanges(allow);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
{
proxy.NotifyServiceChanges(allow);
});
{
proxy.NotifyServiceChanges(allow);
});

}
};

TEST_F(ServiceDiscoveryTest, return_no_service)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
TEST_F(ServiceDiscoveryTest, return_no_service)
TEST_F(ServiceDiscoveryTest, return_no_service)

TEST_F(ServiceDiscoveryTest, notify_service_change)
{
NotifyServiceChanges(true);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

services::ServiceStub service1_{ serviceDiscoveryEcho, 1 };
services::ServiceStubProxy service1Proxy{ echo, 1 };


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

Comment on lines 4 to 7
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdint>
#include <limits>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdint>
#include <limits>

#include "protobuf/echo/test_doubles/EchoSingleLoopback.hpp"
#include "protobuf/echo/test_doubles/ServiceStub.hpp"
#include "protobuf/meta_services/ServiceDiscoveryEcho.hpp"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdint>
#include <limits>

FindFirstServiceInRangeMock(startServiceId, endServiceId);
MethodDone();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

};
}

namespace application {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
namespace application {
namespace application
{

PeerServiceDiscovererEcho(services::Echo& echo)
: service_discovery::ServiceDiscoveryProxy(echo)
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

Comment on lines 64 to 66
{
FindFirstServiceInRange(0, std::numeric_limits<uint32_t>::max());
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
{
FindFirstServiceInRange(0, std::numeric_limits<uint32_t>::max());
});
{
FindFirstServiceInRange(0, std::numeric_limits<uint32_t>::max());
});

public:
services::MethodSerializerFactory::ForServices<service_discovery::ServiceDiscovery, service_discovery::ServiceDiscoveryResponse>::AndProxies<service_discovery::ServiceDiscoveryProxy, service_discovery::ServiceDiscoveryResponseProxy> serializerFactory;
application::EchoSingleLoopback echo{ serializerFactory };

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

service_discovery::ServiceDiscoveryResponseProxy serviceDiscoveryResponse{ echo };
testing::StrictMock<ServiceDiscoveryMock> serviceDiscovery{ echo };

infra::Execute turnOnNotifyServiceChanges{[this]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
infra::Execute turnOnNotifyServiceChanges{[this]
infra::Execute turnOnNotifyServiceChanges{ [this]

Comment on lines 85 to 86
}};
application::PeerServiceDiscovererEcho discoverer{echo};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
}};
application::PeerServiceDiscovererEcho discoverer{echo};
} };
application::PeerServiceDiscovererEcho discoverer{ echo };

// TEST_F(PeerServiceDiscovererTest, )
// {
// }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

Comment on lines +9 to +10
#include "gmock/gmock.h"
#include "gtest/gtest.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include "gmock/gmock.h"
#include "gtest/gtest.h"

#include "gtest/gtest.h"
#include "protobuf/echo/Echo.hpp"
#include "protobuf/echo/test_doubles/EchoSingleLoopback.hpp"
#include <array>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include <array>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <array>

Comment on lines +145 to +146
application::PeerServiceDiscovererEcho discoverer{echo};
testing::StrictMock<PeerServiceDiscoveryObserverMock> observer{discoverer};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
application::PeerServiceDiscovererEcho discoverer{echo};
testing::StrictMock<PeerServiceDiscoveryObserverMock> observer{discoverer};
application::PeerServiceDiscovererEcho discoverer{ echo };
testing::StrictMock<PeerServiceDiscoveryObserverMock> observer{ discoverer };

Comment on lines 181 to 182
for ( auto service : services )
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
for ( auto service : services )
{
for (auto service : services)
{

Copy link

sonarcloud bot commented May 3, 2024

void ServicesChanged() override
{
Initialize();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

Comment on lines +237 to +239
{
serviceDiscoveryResponse.ServicesChanged();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
{
serviceDiscoveryResponse.ServicesChanged();
});
{
serviceDiscoveryResponse.ServicesChanged();
});

@@ -0,0 +1,70 @@
#include "infra/event/EventDispatcher.hpp"
#include "infra/util/Function.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include "infra/util/Function.hpp"
#include "protobuf/meta_services/PeerServiceDiscoverer.hpp"
#include "infra/util/Function.hpp"

Comment on lines +4 to +5

#include <limits>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include <limits>

{
observer.ServiceDiscoveryComplete(services.range());
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

{
FindFirstServiceInRange(services.back(), std::numeric_limits<uint32_t>::max());
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

void PeerServiceDiscovererEcho::ServicesChanged()
{
Initialize();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change

{
if(obs.AcceptsService(std::get<0>(startMethodArgs)))
{
methodSerializer = obs.StartMethod(std::get<0>(startMethodArgs), std::get<1>(startMethodArgs),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
methodSerializer = obs.StartMethod(std::get<0>(startMethodArgs), std::get<1>(startMethodArgs),
methodSerializer = obs.StartMethod(std::get<0>(startMethodArgs), std::get<1>(startMethodArgs),

#include "infra/util/MemoryRange.hpp"
#include "infra/util/Observer.hpp"
#include "infra/util/test_helper/MemoryRangeMatcher.hpp"
#include "gmock/gmock.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include "gmock/gmock.h"
#include "protobuf/echo/test_doubles/EchoSingleLoopback.hpp"
#include "protobuf/meta_services/PeerServiceDiscoverer.hpp"
#include "gmock/gmock.h"

Comment on lines +9 to +10
#include "protobuf/meta_services/PeerServiceDiscoverer.hpp"
#include "protobuf/echo/test_doubles/EchoSingleLoopback.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
#include "protobuf/meta_services/PeerServiceDiscoverer.hpp"
#include "protobuf/echo/test_doubles/EchoSingleLoopback.hpp"

Comment on lines +55 to +58
services::MethodSerializerFactory::ForServices<service_discovery::ServiceDiscovery,
service_discovery::ServiceDiscoveryResponse>::AndProxies<service_discovery::ServiceDiscoveryProxy,
service_discovery::ServiceDiscoveryResponseProxy> serializerFactory;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
services::MethodSerializerFactory::ForServices<service_discovery::ServiceDiscovery,
service_discovery::ServiceDiscoveryResponse>::AndProxies<service_discovery::ServiceDiscoveryProxy,
service_discovery::ServiceDiscoveryResponseProxy> serializerFactory;
services::MethodSerializerFactory::ForServices<service_discovery::ServiceDiscovery,
service_discovery::ServiceDiscoveryResponse>::AndProxies<service_discovery::ServiceDiscoveryProxy,
service_discovery::ServiceDiscoveryResponseProxy>
serializerFactory;

void QueryServices(infra::MemoryRange<uint32_t> services)
{
for (auto service : services)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MegaLinter] reported by reviewdog 🐶

Suggested change
{
{

Copy link

sonarcloud bot commented Jun 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant