Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Difference between FDS record key and record ID

Hi,

The title summarizes the question. I don't understand the difference between the record key and the record ID.

The documentation doesn't really help me understand this. How does the record key not identify the record? Or why is it necessary to have a separate 32-bit ID?

Parents
  • A record key, file combination is not unique, thus the system needs another way to uniquely identify a record, i.e. the record ID. For example you could have a 100 records with key: K and file: F, but each would have a unique record ID.

    Plus, the record ID is not visible to the user and it can't be chosen, or manipulated; it is only assigned and used by the system as opposed from the record key, which can be chosen.

Reply
  • A record key, file combination is not unique, thus the system needs another way to uniquely identify a record, i.e. the record ID. For example you could have a 100 records with key: K and file: F, but each would have a unique record ID.

    Plus, the record ID is not visible to the user and it can't be chosen, or manipulated; it is only assigned and used by the system as opposed from the record key, which can be chosen.

Children
  • the system needs another way to uniquely identify a record

    Why does the system need to identify records?

    the record ID is not visible to the user

    It is visible and accessible.

  • Because operations on records, such as find, open, delete etc. need to work on one specific record.

    When you ask the system to delete a record with key: K and file F, you ask to delete -one- specific record among many that can have that key and file combination, the system needs to know which specific record to delete and that's not identifiable by a key and file combination only.

    The record ID is visible in a descriptor once it is populated but it can't be manipulated in any way, nor there is any FDS API which takes a record ID directly..

  • I was looking at the implementation and I figured it out. However, the naming is terrible.

  • the naming is terrible

    Indeed.

    And, as previously noted, not just here.

    Disappointed

  • And if you have 100 records all with the same file ID and record key, how would you be able to distinguish one from the other? I mean, how would you as a developer know which from the 100 records to write, read or update? Why would you do that?