Skip to content

Commit ea1c8ba

Browse files
committed
ocispec: add allowed connections field to service config
Signed-off-by: Oleksandr Grytsov <[email protected]>
1 parent 8da3523 commit ea1c8ba

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

src/core/cm/config.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,4 @@
77
#ifndef AOS_CORE_CM_CONFIG_HPP_
88
#define AOS_CORE_CM_CONFIG_HPP_
99

10-
/**
11-
* Max number of service instance connections.
12-
*/
13-
#ifndef AOS_CONFIG_NETWORKMANAGER_CONNECTIONS_PER_INSTANCE_MAX_COUNT
14-
#define AOS_CONFIG_NETWORKMANAGER_CONNECTIONS_PER_INSTANCE_MAX_COUNT 16
15-
#endif
16-
1710
#endif

src/core/cm/networkmanager/itf/networkmanager.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ namespace aos::cm::networkmanager {
1616
* @{
1717
*/
1818

19-
/**
20-
* Max number of allowed connections.
21-
*/
22-
static constexpr auto cMaxNumConnections = AOS_CONFIG_NETWORKMANAGER_CONNECTIONS_PER_INSTANCE_MAX_COUNT;
23-
24-
/**
25-
* Max length of connection name.
26-
*/
27-
static constexpr auto cConnectionNameLen = cServiceIDLen + cExposedPortLen;
28-
2919
/**
3020
* Represents network configuration parameters for service.
3121
*/

src/core/common/config.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,13 @@
547547
#define AOS_CONFIG_TYPES_MAX_NUM_EXPOSED_PORTS 8
548548
#endif
549549

550+
/**
551+
* Max number of service instance connections.
552+
*/
553+
#ifndef AOS_CONFIG_TYPES_MAX_NUM_ALLOWED_CONNECTIONS
554+
#define AOS_CONFIG_TYPES_MAX_NUM_ALLOWED_CONNECTIONS 16
555+
#endif
556+
550557
/**
551558
* Identifier URN len.
552559
*/

src/core/common/ocispec/serviceconfig.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ struct ServiceConfig {
113113
Duration mOfflineTTL;
114114
ServiceQuotas mQuotas;
115115
Optional<RequestedResources> mRequestedResources;
116+
StaticArray<StaticString<cConnectionNameLen>, cMaxNumConnections> mAllowedConnections;
116117
StaticArray<ServiceDevice, cMaxNumNodeDevices> mDevices;
117118
StaticArray<StaticString<cResourceNameLen>, cMaxNumNodeResources> mResources;
118119
StaticArray<FunctionServicePermissions, cFuncServiceMaxCount> mPermissions;
@@ -130,8 +131,8 @@ struct ServiceConfig {
130131
&& mSkipResourceLimits == config.mSkipResourceLimits && mHostname == config.mHostname
131132
&& mBalancingPolicy == config.mBalancingPolicy && mRunners == config.mRunners
132133
&& mRunParameters == config.mRunParameters && mSysctl == config.mSysctl && mOfflineTTL == config.mOfflineTTL
133-
&& mQuotas == config.mQuotas && mRequestedResources == config.mRequestedResources
134-
&& mAlertRules == config.mAlertRules;
134+
&& mQuotas == config.mQuotas && mAllowedConnections == config.mAllowedConnections
135+
&& mRequestedResources == config.mRequestedResources && mAlertRules == config.mAlertRules;
135136
}
136137

137138
/**

src/core/common/types/types.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,16 @@ static constexpr auto cMaxNumExposedPorts = AOS_CONFIG_TYPES_MAX_NUM_EXPOSED_POR
403403
*/
404404
static constexpr auto cExposedPortLen = cPortLen + cProtocolNameLen;
405405

406+
/**
407+
* Max length of connection name.
408+
*/
409+
static constexpr auto cConnectionNameLen = cServiceIDLen + cExposedPortLen;
410+
411+
/**
412+
* Max number of allowed connections.
413+
*/
414+
static constexpr auto cMaxNumConnections = AOS_CONFIG_TYPES_MAX_NUM_ALLOWED_CONNECTIONS;
415+
406416
/**
407417
* Identifier URN len.
408418
*/

0 commit comments

Comments
 (0)