diff --git a/src/credentials/GroupDataProviderImpl.cpp b/src/credentials/GroupDataProviderImpl.cpp index 87eb9d04d6ee4b..95764967dab051 100644 --- a/src/credentials/GroupDataProviderImpl.cpp +++ b/src/credentials/GroupDataProviderImpl.cpp @@ -33,7 +33,15 @@ using GroupEndpoint = GroupDataProvider::GroupEndpoint; using EpochKey = GroupDataProvider::EpochKey; using KeySet = GroupDataProvider::KeySet; using GroupSession = GroupDataProvider::GroupSession; -using FabricList = CommonPersistentData::FabricList; + +struct FabricList : public CommonPersistentData::FabricList +{ + CHIP_ERROR UpdateKey(StorageKeyName & key) override + { + key = DefaultStorageKeyAllocator::GroupFabricList(); + return CHIP_NO_ERROR; + } +}; constexpr size_t kPersistentBufferMax = 128; diff --git a/src/lib/support/CommonPersistentData.h b/src/lib/support/CommonPersistentData.h index 24c3e9a0354ce4..f04ba591959c4e 100644 --- a/src/lib/support/CommonPersistentData.h +++ b/src/lib/support/CommonPersistentData.h @@ -76,11 +76,8 @@ struct StoredDataList : public PersistentData constexpr size_t kPersistentFabricBufferMax = 32; struct FabricList : StoredDataList { - CHIP_ERROR UpdateKey(StorageKeyName & key) override - { - key = DefaultStorageKeyAllocator::FabricList(); - return CHIP_NO_ERROR; - } + // Subclasses need to define UpdateKey to be whatever fabric list key they + // care about. void Clear() override { diff --git a/src/lib/support/DefaultStorageKeyAllocator.h b/src/lib/support/DefaultStorageKeyAllocator.h index dd7098ecf607f9..6a4b906c2426b8 100644 --- a/src/lib/support/DefaultStorageKeyAllocator.h +++ b/src/lib/support/DefaultStorageKeyAllocator.h @@ -102,9 +102,6 @@ class DefaultStorageKeyAllocator static StorageKeyName FabricMetadata(FabricIndex fabric) { return StorageKeyName::Formatted("f/%x/m", fabric); } static StorageKeyName FabricOpKey(FabricIndex fabric) { return StorageKeyName::Formatted("f/%x/o", fabric); } - // Fabric List - static StorageKeyName FabricList() { return StorageKeyName::FromConst("g/fl"); } - // Fail-safe handling static StorageKeyName FailSafeCommitMarkerKey() { return StorageKeyName::FromConst("g/fs/c"); } static StorageKeyName FailSafeNetworkConfig() { return StorageKeyName::FromConst("g/fs/n"); } @@ -147,6 +144,7 @@ class DefaultStorageKeyAllocator // Group Data Provider // List of fabric indices that have endpoint-to-group associations defined. + static StorageKeyName GroupFabricList() { return StorageKeyName::FromConst("g/gfl"); } static StorageKeyName FabricGroups(chip::FabricIndex fabric) { return StorageKeyName::Formatted("f/%x/g", fabric); } static StorageKeyName FabricGroup(chip::FabricIndex fabric, chip::GroupId group) {