function DiscardPendingChanges [SWS_PER_00365] Upstream: RS_PER_00002, RS_AP_00119, RS_AP_00120, RS_AP_00127, RS_AP_00128, RS_AP_00129, RS_AP_00135, RS_AP_00139, RS_AP_00159
ara::core::Result< void > DiscardPendingChanges () noexcept;
Removes all pending changes to this Key-Value Storage since the last call to SyncToStorage() or since this Key-Value Storage was opened using OpenKeyValueStorage(). DiscardPendingChanges may be delayed by an ongoing call from another thread to RemoveAll Keys, SyncToStorage, DiscardPendingChanges, SetValue, GetValue, GetCurrentValueSize, RemoveKey, RecoverKey, or ResetKey.
Usage and Semantics
The synchronous member function DiscardPendingChanges of class ara::per::KeyValueStorage ([SWS_PER_00365]) is provided via header ara/per/key_value_storage.h. It takes no parameters and returns a ara::core::Result<void>. Its purpose is to discard all pending changes to the key-value storage instance that have accumulated since the last call to SyncToStorage or since opening via OpenKeyValueStorage() [SWS_PER_00365].
Interaction and Transaction Behavior
Writing operations such as SetValue [SWS_PER_00046], RemoveKey [SWS_PER_00047], and RemoveAllKeys [SWS_PER_00048] are subject to transaction semantics. Their changes are written permanently to the physical storage medium only upon calling SyncToStorage [SWS_PER_00049]. Through DiscardPendingChanges, these unsaved modifications are rolled back, so that queries via GetCurrentValueSize also reflect the previous transactional initial state again [SWS_PER_00554].
Error Handling and Concurrency
In case of an error, the result contains a vendor-specific error or an error code from PerErrc with defined rollback semantics [SWS_PER_00365]:
PerErrc::kIllegalWriteAccess: if the storage is read-only or, in a write-only-once configuration, the key already exists.PerErrc::kPhysicalStorageFailure: if access to the physical storage medium fails.PerErrc::kIntegrityCorrupted,PerErrc::kValidationFailed,PerErrc::kEncryptionFailed, orPerErrc::kAuthenticationFailed: in case of loss of integrity, validation errors, decryption errors, or failed MAC verification.
The method is declared as noexcept, exception-safe, and thread-safe [SWS_PER_00365]. However, execution may be delayed if calls to SyncToStorage, SetValue, RemoveKey, RemoveAllKeys, ResetKey, or RecoverKey are active in parallel in other threads [SWS_PER_00365] [SWS_PER_00426] [SWS_PER_00427].
This text was generated by an AI and curated based on the AUTOSAR specification.
Implementer's Guide to follow (complexity I2)
| Header-Datei | #include "ara/per/key_value_storage.h" |
|---|---|
| Scope | class ara::per::KeyValueStorage |
| Exception-Sicherheit | exception safe |
| Thread-Sicherheit | thread-safe |
Rückgabewert
| Typ | Beschreibung |
|---|---|
| ara::core::Result< void > | A Result of void. In case of an error, it contains any of the errors defined below, or a vendor specific error. |
Fehler
| Fehlercode | Beschreibung |
|---|---|
| PerErrc::kIllegalWriteAccess | rollback_semantics Returned if the Key-Value Storage is configured as read- only, or if it is configured as write-only-once and the key already exists. |
| PerErrc::kPhysicalStorageFailure | rollback_semantics Returned if access to the physical storage fails. |
| PerErrc::kIntegrityCorrupted | rollback_semantics Returned if stored data cannot be read because the structural integrity is corrupted. |
| PerErrc::kValidationFailed | rollback_semantics Returned if the validity of stored data cannot be ensured. |
| PerErrc::kEncryptionFailed | rollback_semantics Returned if the decryption of stored data fails. |
| PerErrc::kAuthenticationFailed | rollback_semantics Returned if checking the MAC of stored data fails. |
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/SWS_PER_00365- Status
- valid/unmigrated
- Version
AUTOSAR/AP/record/SWS_PER_00365@rel:R25-11#0793e9a5- Content hash
0793e9a5- Source
- https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Persistency.pdf#nameddest=SWS_PER_00365
Status: valid/unmigrated
Version: rel:R25-11#f3496212
Versionshistorie & Revisions (1 transition, 8 revision)
- Current State
valid/unmigrated- Reason
- mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
- Campaign
2026-08-13-status-backfill- Active Version
AUTOSAR/AP/record/SWS_PER_00365@rel:R25-11#f3496212
Recorded Revisions (8):
- R25-11
rel:R25-11#0793e9a52026-09-30 - R19-11
rel:R19-11#90dcd0d22026-10-14 - R20-11
rel:R20-11#306302ca2026-10-14 - R21-11
rel:R21-11#5bb9ceb52026-10-14 - R22-11
rel:R22-11#6374aaa62026-10-14 - R23-11
rel:R23-11#7a4bc2902026-10-14 - R24-11
rel:R24-11#fd18fb832026-10-14 - R25-11
rel:R25-11#f34962122026-10-14 active
Requirement Text as-of this release:
Curation Decisions:
Reachable Artifacts & Dependents:
| Date | Actor | Transition | Reason / Rationale | Campaign |
|---|---|---|---|---|
| 2026-08-13 | tool | none → valid/unmigrated | mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record | 2026-08-13-status-backfill |
gemini-3.8-flash-low· 2026-10-13 · German original