Skip to content

Commit 7b2adc6

Browse files
API renames: chip::app::InteractionModel::* becomes chip::app::DataModel and renamed DataModel to Provider (#34520)
* Massive file name renames. No namespace renames yet * Restyle * Fix missed rename * more renames * Set of renames * Some final renames. Unit tests compile and pass * Restyle * Also rename the IME data model setter/getter * member renames * Slight rename * Restyle * Fix lint --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com>
1 parent 5d1f1d6 commit 7b2adc6

File tree

68 files changed

+407
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+407
-412
lines changed

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ jobs:
290290
git grep -I -n 'emberAfWriteAttribute' -- './*' \
291291
':(exclude).github/workflows/lint.yml' \
292292
':(exclude)examples/common/pigweed/rpc_services/Attributes.h' \
293-
':(exclude)src/app/codegen-data-model/CodegenDataModel_Write.cpp' \
294-
':(exclude)src/app/codegen-data-model/tests/EmberReadWriteOverride.cpp' \
293+
':(exclude)src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp' \
294+
':(exclude)src/app/codegen-data-model-provider/tests/EmberReadWriteOverride.cpp' \
295295
':(exclude)src/app/util/attribute-table.cpp' \
296296
':(exclude)src/app/util/attribute-table.h' \
297297
':(exclude)src/app/util/ember-compatibility-functions.cpp' \

src/BUILD.gn

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if (chip_build_tests) {
5252
tests = [
5353
"${chip_root}/src/app/data-model/tests",
5454
"${chip_root}/src/app/cluster-building-blocks/tests",
55-
"${chip_root}/src/app/data-model-interface/tests",
55+
"${chip_root}/src/app/data-model-provider/tests",
5656
"${chip_root}/src/access/tests",
5757
"${chip_root}/src/crypto/tests",
5858
"${chip_root}/src/inet/tests",
@@ -87,11 +87,11 @@ if (chip_build_tests) {
8787
# are split, we can re-visit this (and likely many others)
8888
#
8989
# In particular:
90-
# "app/codegen-data-model/tests" contains symbols for ember mocks which
90+
# "app/codegen-data-model-provider/tests" contains symbols for ember mocks which
9191
# are used by other tests
9292

9393
tests += [
94-
"${chip_root}/src/app/codegen-data-model/tests",
94+
"${chip_root}/src/app/codegen-data-model-provider/tests",
9595
"${chip_root}/src/setup_payload/tests",
9696
"${chip_root}/src/transport/raw/tests",
9797
]

src/app/AttributePathExpandIterator-Checked.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace chip {
2222
namespace app {
23-
AttributePathExpandIteratorChecked::AttributePathExpandIteratorChecked(InteractionModel::DataModel * dataModel,
23+
AttributePathExpandIteratorChecked::AttributePathExpandIteratorChecked(DataModel::Provider * dataModel,
2424
SingleLinkedListNode<AttributePathParams> * attributePath) :
2525
mDataModelIterator(dataModel, attributePath),
2626
mEmberIterator(dataModel, attributePath)

src/app/AttributePathExpandIterator-Checked.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ namespace app {
2626
class AttributePathExpandIteratorChecked
2727
{
2828
public:
29-
AttributePathExpandIteratorChecked(InteractionModel::DataModel * dataModel,
30-
SingleLinkedListNode<AttributePathParams> * attributePath);
29+
AttributePathExpandIteratorChecked(DataModel::Provider * dataModel, SingleLinkedListNode<AttributePathParams> * attributePath);
3130

3231
bool Next();
3332
bool Get(ConcreteAttributePath & aPath);

src/app/AttributePathExpandIterator-DataModel.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
#include <app/AttributePathExpandIterator-DataModel.h>
1919
#include <app/GlobalAttributes.h>
2020

21-
using namespace chip::app::InteractionModel;
21+
using namespace chip::app::DataModel;
2222

2323
namespace chip {
2424
namespace app {
2525

2626
AttributePathExpandIteratorDataModel::AttributePathExpandIteratorDataModel(
27-
InteractionModel::DataModel * dataModel, SingleLinkedListNode<AttributePathParams> * attributePath) :
28-
mDataModel(dataModel),
27+
DataModel::Provider * provider, SingleLinkedListNode<AttributePathParams> * attributePath) :
28+
mDataModelProvider(provider),
2929
mpAttributePath(attributePath), mOutputPath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId)
3030

3131
{
@@ -52,7 +52,7 @@ bool AttributePathExpandIteratorDataModel::IsValidAttributeId(AttributeId attrib
5252
}
5353

5454
const ConcreteAttributePath attributePath(mOutputPath.mEndpointId, mOutputPath.mClusterId, attributeId);
55-
return mDataModel->GetAttributeInfo(attributePath).has_value();
55+
return mDataModelProvider->GetAttributeInfo(attributePath).has_value();
5656
}
5757

5858
std::optional<AttributeId> AttributePathExpandIteratorDataModel::NextAttributeId()
@@ -61,7 +61,7 @@ std::optional<AttributeId> AttributePathExpandIteratorDataModel::NextAttributeId
6161
{
6262
if (mpAttributePath->mValue.HasWildcardAttributeId())
6363
{
64-
AttributeEntry entry = mDataModel->FirstAttribute(mOutputPath);
64+
AttributeEntry entry = mDataModelProvider->FirstAttribute(mOutputPath);
6565
return entry.IsValid() //
6666
? entry.path.mAttributeId //
6767
: Clusters::Globals::Attributes::GeneratedCommandList::Id; //
@@ -99,7 +99,7 @@ std::optional<AttributeId> AttributePathExpandIteratorDataModel::NextAttributeId
9999
return std::nullopt;
100100
}
101101

102-
AttributeEntry entry = mDataModel->NextAttribute(mOutputPath);
102+
AttributeEntry entry = mDataModelProvider->NextAttribute(mOutputPath);
103103
if (entry.IsValid())
104104
{
105105
return entry.path.mAttributeId;
@@ -117,13 +117,13 @@ std::optional<ClusterId> AttributePathExpandIteratorDataModel::NextClusterId()
117117
{
118118
if (mpAttributePath->mValue.HasWildcardClusterId())
119119
{
120-
ClusterEntry entry = mDataModel->FirstCluster(mOutputPath.mEndpointId);
120+
ClusterEntry entry = mDataModelProvider->FirstCluster(mOutputPath.mEndpointId);
121121
return entry.IsValid() ? std::make_optional(entry.path.mClusterId) : std::nullopt;
122122
}
123123

124124
// only return a cluster if it is valid
125125
const ConcreteClusterPath clusterPath(mOutputPath.mEndpointId, mpAttributePath->mValue.mClusterId);
126-
if (!mDataModel->GetClusterInfo(clusterPath).has_value())
126+
if (!mDataModelProvider->GetClusterInfo(clusterPath).has_value())
127127
{
128128
return std::nullopt;
129129
}
@@ -133,7 +133,7 @@ std::optional<ClusterId> AttributePathExpandIteratorDataModel::NextClusterId()
133133

134134
VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardClusterId(), std::nullopt);
135135

136-
ClusterEntry entry = mDataModel->NextCluster(mOutputPath);
136+
ClusterEntry entry = mDataModelProvider->NextCluster(mOutputPath);
137137
return entry.IsValid() ? std::make_optional(entry.path.mClusterId) : std::nullopt;
138138
}
139139

@@ -143,7 +143,7 @@ std::optional<ClusterId> AttributePathExpandIteratorDataModel::NextEndpointId()
143143
{
144144
if (mpAttributePath->mValue.HasWildcardEndpointId())
145145
{
146-
EndpointId id = mDataModel->FirstEndpoint();
146+
EndpointId id = mDataModelProvider->FirstEndpoint();
147147
return (id != kInvalidEndpointId) ? std::make_optional(id) : std::nullopt;
148148
}
149149

@@ -152,7 +152,7 @@ std::optional<ClusterId> AttributePathExpandIteratorDataModel::NextEndpointId()
152152

153153
VerifyOrReturnValue(mpAttributePath->mValue.HasWildcardEndpointId(), std::nullopt);
154154

155-
EndpointId id = mDataModel->NextEndpoint(mOutputPath.mEndpointId);
155+
EndpointId id = mDataModelProvider->NextEndpoint(mOutputPath.mEndpointId);
156156
return (id != kInvalidEndpointId) ? std::make_optional(id) : std::nullopt;
157157
}
158158

src/app/AttributePathExpandIterator-DataModel.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include <app/AttributePathParams.h>
2020
#include <app/ConcreteAttributePath.h>
21-
#include <app/data-model-interface/DataModel.h>
21+
#include <app/data-model-provider/Provider.h>
2222
#include <lib/support/LinkedList.h>
2323

2424
namespace chip {
@@ -53,8 +53,7 @@ namespace app {
5353
class AttributePathExpandIteratorDataModel
5454
{
5555
public:
56-
AttributePathExpandIteratorDataModel(InteractionModel::DataModel * dataModel,
57-
SingleLinkedListNode<AttributePathParams> * attributePath);
56+
AttributePathExpandIteratorDataModel(DataModel::Provider * provider, SingleLinkedListNode<AttributePathParams> * attributePath);
5857

5958
/**
6059
* Proceed the iterator to the next attribute path in the given cluster info.
@@ -85,11 +84,11 @@ class AttributePathExpandIteratorDataModel
8584
/** Start iterating over the given `paths` */
8685
inline void ResetTo(SingleLinkedListNode<AttributePathParams> * paths)
8786
{
88-
*this = AttributePathExpandIteratorDataModel(mDataModel, paths);
87+
*this = AttributePathExpandIteratorDataModel(mDataModelProvider, paths);
8988
}
9089

9190
private:
92-
InteractionModel::DataModel * mDataModel;
91+
DataModel::Provider * mDataModelProvider;
9392
SingleLinkedListNode<AttributePathParams> * mpAttributePath;
9493
ConcreteAttributePath mOutputPath;
9594

src/app/AttributePathExpandIterator-Ember.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index);
5353
namespace chip {
5454
namespace app {
5555

56-
AttributePathExpandIteratorEmber::AttributePathExpandIteratorEmber(InteractionModel::DataModel *,
56+
AttributePathExpandIteratorEmber::AttributePathExpandIteratorEmber(DataModel::Provider *,
5757
SingleLinkedListNode<AttributePathParams> * aAttributePath) :
5858
mpAttributePath(aAttributePath)
5959
{

src/app/AttributePathExpandIterator-Ember.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <app/AttributePathParams.h>
2828
#include <app/ConcreteAttributePath.h>
2929
#include <app/EventManagement.h>
30-
#include <app/data-model-interface/DataModel.h>
30+
#include <app/data-model-provider/Provider.h>
3131
#include <lib/core/CHIPCore.h>
3232
#include <lib/support/CodeUtils.h>
3333
#include <lib/support/DLLUtil.h>
@@ -70,7 +70,7 @@ namespace app {
7070
class AttributePathExpandIteratorEmber
7171
{
7272
public:
73-
AttributePathExpandIteratorEmber(InteractionModel::DataModel *, // datamodel is NOT used by this class
73+
AttributePathExpandIteratorEmber(DataModel::Provider *, // datamodel is NOT used by this class
7474
SingleLinkedListNode<AttributePathParams> * aAttributePath);
7575

7676
/**

src/app/BUILD.gn

+6-6
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ static_library("interaction-model") {
234234
":paths",
235235
":subscription-info-provider",
236236
"${chip_root}/src/app/MessageDef",
237-
"${chip_root}/src/app/codegen-data-model:instance-header",
238-
"${chip_root}/src/app/data-model-interface",
237+
"${chip_root}/src/app/codegen-data-model-provider:instance-header",
238+
"${chip_root}/src/app/data-model-provider",
239239
"${chip_root}/src/app/icd/server:icd-server-config",
240240
"${chip_root}/src/app/icd/server:manager",
241241
"${chip_root}/src/app/icd/server:observer",
@@ -265,13 +265,13 @@ static_library("interaction-model") {
265265
"reporting/Read-Ember.cpp",
266266
"reporting/Read-Ember.h",
267267
]
268-
public_deps += [ "${chip_root}/src/app/data-model-interface" ]
268+
public_deps += [ "${chip_root}/src/app/data-model-provider" ]
269269
} else { # enabled
270270
sources += [
271271
"reporting/Read-DataModel.cpp",
272272
"reporting/Read-DataModel.h",
273273
]
274-
public_deps += [ "${chip_root}/src/app/data-model-interface" ]
274+
public_deps += [ "${chip_root}/src/app/data-model-provider" ]
275275
}
276276

277277
if (chip_enable_read_client) {
@@ -491,14 +491,14 @@ static_library("app") {
491491
"AttributePathExpandIterator-Ember.h",
492492
"AttributePathExpandIterator.h",
493493
]
494-
public_deps += [ "${chip_root}/src/app/data-model-interface" ]
494+
public_deps += [ "${chip_root}/src/app/data-model-provider" ]
495495
} else { # enabled
496496
sources += [
497497
"AttributePathExpandIterator-DataModel.cpp",
498498
"AttributePathExpandIterator-DataModel.h",
499499
"AttributePathExpandIterator.h",
500500
]
501-
public_deps += [ "${chip_root}/src/app/data-model-interface" ]
501+
public_deps += [ "${chip_root}/src/app/data-model-provider" ]
502502
}
503503

504504
if (chip_enable_read_client) {

src/app/InteractionModelEngine.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include <lib/support/FibonacciUtils.h>
4444

4545
#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE
46-
#include <app/codegen-data-model/Instance.h>
46+
#include <app/codegen-data-model-provider/Instance.h>
4747
#endif
4848

4949
namespace chip {
@@ -485,7 +485,7 @@ CHIP_ERROR InteractionModelEngine::ParseAttributePaths(const Access::SubjectDesc
485485

486486
if (paramsList.mValue.IsWildcardPath())
487487
{
488-
AttributePathExpandIterator pathIterator(GetDataModel(), &paramsList);
488+
AttributePathExpandIterator pathIterator(GetDataModelProvider(), &paramsList);
489489
ConcreteAttributePath readPath;
490490

491491
// The definition of "valid path" is "path exists and ACL allows access". The "path exists" part is handled by
@@ -849,7 +849,7 @@ Protocols::InteractionModel::Status InteractionModelEngine::OnReadInitialRequest
849849
// We have already reserved enough resources for read requests, and have granted enough resources for current subscriptions, so
850850
// we should be able to allocate resources requested by this request.
851851
ReadHandler * handler =
852-
mReadHandlers.CreateObject(*this, apExchangeContext, aInteractionType, mReportScheduler, GetDataModel());
852+
mReadHandlers.CreateObject(*this, apExchangeContext, aInteractionType, mReportScheduler, GetDataModelProvider());
853853
if (handler == nullptr)
854854
{
855855
ChipLogProgress(InteractionModel, "no resource for %s interaction",
@@ -1706,23 +1706,23 @@ Protocols::InteractionModel::Status InteractionModelEngine::CommandExists(const
17061706
return ServerClusterCommandExists(aCommandPath);
17071707
}
17081708

1709-
InteractionModel::DataModel * InteractionModelEngine::SetDataModel(InteractionModel::DataModel * model)
1709+
DataModel::Provider * InteractionModelEngine::SetDataModelProvider(DataModel::Provider * model)
17101710
{
17111711
// Alternting data model should not be done while IM is actively handling requests.
17121712
VerifyOrDie(mReadHandlers.begin() == mReadHandlers.end());
17131713

1714-
InteractionModel::DataModel * oldModel = GetDataModel();
1715-
mDataModel = model;
1714+
DataModel::Provider * oldModel = GetDataModelProvider();
1715+
mDataModelProvider = model;
17161716
return oldModel;
17171717
}
17181718

1719-
InteractionModel::DataModel * InteractionModelEngine::GetDataModel() const
1719+
DataModel::Provider * InteractionModelEngine::GetDataModelProvider() const
17201720
{
17211721
#if CHIP_CONFIG_USE_DATA_MODEL_INTERFACE
17221722
// TODO: this should be temporary, we should fully inject the data model
1723-
VerifyOrReturnValue(mDataModel != nullptr, CodegenDataModelInstance());
1723+
VerifyOrReturnValue(mDataModelProvider != nullptr, CodegenDataModelProviderInstance());
17241724
#endif
1725-
return mDataModel;
1725+
return mDataModelProvider;
17261726
}
17271727

17281728
void InteractionModelEngine::OnTimedInteractionFailed(TimedHandler * apTimedHandler)

src/app/InteractionModelEngine.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#include <app/TimedHandler.h>
5050
#include <app/WriteClient.h>
5151
#include <app/WriteHandler.h>
52-
#include <app/data-model-interface/DataModel.h>
52+
#include <app/data-model-provider/Provider.h>
5353
#include <app/icd/server/ICDServerConfig.h>
5454
#include <app/reporting/Engine.h>
5555
#include <app/reporting/ReportScheduler.h>
@@ -402,14 +402,14 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
402402
}
403403
#endif
404404

405-
InteractionModel::DataModel * GetDataModel() const;
405+
DataModel::Provider * GetDataModelProvider() const;
406406

407407
// MUST NOT be used while the interaction model engine is running as interaction
408408
// model functionality (e.g. active reads/writes/subscriptions) rely on data model
409409
// state
410410
//
411-
// Returns the old data model value.
412-
InteractionModel::DataModel * SetDataModel(InteractionModel::DataModel * model);
411+
// Returns the old data model provider value.
412+
DataModel::Provider * SetDataModelProvider(DataModel::Provider * model);
413413

414414
private:
415415
friend class reporting::Engine;
@@ -698,7 +698,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler,
698698

699699
SubscriptionResumptionStorage * mpSubscriptionResumptionStorage = nullptr;
700700

701-
InteractionModel::DataModel * mDataModel = nullptr;
701+
DataModel::Provider * mDataModelProvider = nullptr;
702702
};
703703

704704
} // namespace app

src/app/ReadHandler.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
*
2323
*/
2424

25-
#include "data-model-interface/DataModel.h"
2625
#include <app/AppConfig.h>
2726
#include <app/InteractionModelEngine.h>
2827
#include <app/MessageDef/EventPathIB.h>
2928
#include <app/MessageDef/StatusResponseMessage.h>
3029
#include <app/MessageDef/SubscribeRequestMessage.h>
3130
#include <app/MessageDef/SubscribeResponseMessage.h>
31+
#include <app/data-model-provider/Provider.h>
3232
#include <app/icd/server/ICDServerConfig.h>
3333
#include <lib/core/TLVUtilities.h>
3434
#include <messaging/ExchangeContext.h>
@@ -54,7 +54,7 @@ uint16_t ReadHandler::GetPublisherSelectedIntervalLimit()
5454
}
5555

5656
ReadHandler::ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeContext * apExchangeContext,
57-
InteractionType aInteractionType, Observer * observer, InteractionModel::DataModel * apDataModel) :
57+
InteractionType aInteractionType, Observer * observer, DataModel::Provider * apDataModel) :
5858
mAttributePathExpandIterator(apDataModel, nullptr),
5959
mExchangeCtx(*this), mManagementCallback(apCallback)
6060
{
@@ -80,7 +80,7 @@ ReadHandler::ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeCon
8080
}
8181

8282
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
83-
ReadHandler::ReadHandler(ManagementCallback & apCallback, Observer * observer, InteractionModel::DataModel * apDataModel) :
83+
ReadHandler::ReadHandler(ManagementCallback & apCallback, Observer * observer, DataModel::Provider * apDataModel) :
8484
mAttributePathExpandIterator(apDataModel, nullptr), mExchangeCtx(*this), mManagementCallback(apCallback)
8585
{
8686
mInteractionType = InteractionType::Subscribe;

src/app/ReadHandler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
212212
*
213213
*/
214214
ReadHandler(ManagementCallback & apCallback, Messaging::ExchangeContext * apExchangeContext, InteractionType aInteractionType,
215-
Observer * observer, InteractionModel::DataModel * apDataModel);
215+
Observer * observer, DataModel::Provider * apDataModel);
216216

217217
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
218218
/**
@@ -222,7 +222,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
222222
* The callback passed in has to outlive this handler object.
223223
*
224224
*/
225-
ReadHandler(ManagementCallback & apCallback, Observer * observer, InteractionModel::DataModel * apDataModel);
225+
ReadHandler(ManagementCallback & apCallback, Observer * observer, DataModel::Provider * apDataModel);
226226
#endif
227227

228228
const SingleLinkedListNode<AttributePathParams> * GetAttributePathList() const { return mpAttributePathList; }

0 commit comments

Comments
 (0)