Skip to content

Commit 5a5dfe7

Browse files
adigiegmarcosb
authored andcommitted
Fix method naming and cleanup FailSafeContext (project-chip#37820)
* Rename FailSafeCommitMarkerKey to FabricTableCommitMarkerKey Commit marker was moved from FailSafeContext to FabricTable in project-chip#20010, however name of the key wasn't changed and it's misleading. This commit changes the name of the method returning commit marker key, but keeps the key name for backward compatibility. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no> * Remove declaration of non-existent method CommitToStorage was removed in project-chip#20010. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no> --------- Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent f9189d9 commit 5a5dfe7

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/app/FailSafeContext.h

-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ class FailSafeContext
152152
}
153153

154154
void FailSafeTimerExpired();
155-
CHIP_ERROR CommitToStorage();
156155
};
157156

158157
} // namespace app

src/credentials/FabricTable.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ CHIP_ERROR FabricTable::StoreCommitMarker(const CommitMarker & commitMarker)
14661466
const auto markerContextTLVLength = writer.GetLengthWritten();
14671467
VerifyOrReturnError(CanCastTo<uint16_t>(markerContextTLVLength), CHIP_ERROR_BUFFER_TOO_SMALL);
14681468

1469-
return mStorage->SyncSetKeyValue(DefaultStorageKeyAllocator::FailSafeCommitMarkerKey().KeyName(), tlvBuf,
1469+
return mStorage->SyncSetKeyValue(DefaultStorageKeyAllocator::FabricTableCommitMarkerKey().KeyName(), tlvBuf,
14701470
static_cast<uint16_t>(markerContextTLVLength));
14711471
}
14721472

@@ -1475,7 +1475,7 @@ CHIP_ERROR FabricTable::GetCommitMarker(CommitMarker & outCommitMarker)
14751475
uint8_t tlvBuf[CommitMarkerContextTLVMaxSize()];
14761476
uint16_t tlvSize = sizeof(tlvBuf);
14771477
ReturnErrorOnFailure(
1478-
mStorage->SyncGetKeyValue(DefaultStorageKeyAllocator::FailSafeCommitMarkerKey().KeyName(), tlvBuf, tlvSize));
1478+
mStorage->SyncGetKeyValue(DefaultStorageKeyAllocator::FabricTableCommitMarkerKey().KeyName(), tlvBuf, tlvSize));
14791479

14801480
// If buffer was too small, we won't reach here.
14811481
TLV::ContiguousBufferTLVReader reader;
@@ -1499,7 +1499,7 @@ CHIP_ERROR FabricTable::GetCommitMarker(CommitMarker & outCommitMarker)
14991499

15001500
void FabricTable::ClearCommitMarker()
15011501
{
1502-
mStorage->SyncDeleteKeyValue(DefaultStorageKeyAllocator::FailSafeCommitMarkerKey().KeyName());
1502+
mStorage->SyncDeleteKeyValue(DefaultStorageKeyAllocator::FabricTableCommitMarkerKey().KeyName());
15031503
}
15041504

15051505
bool FabricTable::HasOperationalKeyForFabric(FabricIndex fabricIndex) const

src/lib/support/DefaultStorageKeyAllocator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class DefaultStorageKeyAllocator
103103
static StorageKeyName FabricOpKey(FabricIndex fabric) { return StorageKeyName::Formatted("f/%x/o", fabric); }
104104

105105
// Fail-safe handling
106-
static StorageKeyName FailSafeCommitMarkerKey() { return StorageKeyName::FromConst("g/fs/c"); }
106+
static StorageKeyName FabricTableCommitMarkerKey() { return StorageKeyName::FromConst("g/fs/c"); }
107107
static StorageKeyName FailSafeNetworkConfig() { return StorageKeyName::FromConst("g/fs/n"); }
108108

109109
// LastKnownGoodTime

0 commit comments

Comments
 (0)