Skip to content

Commit 8b268ab

Browse files
committed
ocispec: add allowed connections field to service config
Signed-off-by: Oleksandr Grytsov <[email protected]> Reviewed-by: Mykola Kobets <[email protected]> Reviewed-by: Mykhailo Lohvynenko <[email protected]> Reviewed-by: Mykola Solianko <[email protected]>
1 parent 7807e53 commit 8b268ab

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
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/imagemanager/itf/imagemanager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct UpdateItemStatus {
9797
}
9898

9999
/**
100-
* @brief Compares update item status.
100+
* Compares update item status.
101101
*
102102
* @param other update item status to compare with.
103103
* @return bool.

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
@@ -540,6 +540,13 @@
540540
#define AOS_CONFIG_TYPES_MAX_NUM_EXPOSED_PORTS 8
541541
#endif
542542

543+
/**
544+
* Max number of service instance connections.
545+
*/
546+
#ifndef AOS_CONFIG_TYPES_MAX_NUM_ALLOWED_CONNECTIONS
547+
#define AOS_CONFIG_TYPES_MAX_NUM_ALLOWED_CONNECTIONS 16
548+
#endif
549+
543550
/**
544551
* Identifier URN len.
545552
*/

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
@@ -398,6 +398,16 @@ static constexpr auto cMaxNumExposedPorts = AOS_CONFIG_TYPES_MAX_NUM_EXPOSED_POR
398398
*/
399399
static constexpr auto cExposedPortLen = cPortLen + cProtocolNameLen;
400400

401+
/**
402+
* Max length of connection name.
403+
*/
404+
static constexpr auto cConnectionNameLen = cServiceIDLen + cExposedPortLen;
405+
406+
/**
407+
* Max number of allowed connections.
408+
*/
409+
static constexpr auto cMaxNumConnections = AOS_CONFIG_TYPES_MAX_NUM_ALLOWED_CONNECTIONS;
410+
401411
/**
402412
* Identifier URN len.
403413
*/

0 commit comments

Comments
 (0)