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

Flash Data Storage (FDS): What is the point of "Files" and "Records"

I find the documentation completely opaque as to the meaning and intended application of what FDS calls  "Files" and "Records".

It seems that what FDS calls a "File" bears no relation at all to the concept of a file as a "container" - as found in other usages.

"Files" and "Records" just seem to be completely unrelated, unconnected, arbitrary identifiers - is that right?

In the SDK 15 FDS example, a complete config structure is stored as a single "Record".

What would be the pros & cons of storing the individual config elements as separate "Records" ?

Would it make any difference if they all had the same "File" ID or not ?

Parents
  • Hi,

    I think this is well explained in the documentation:

    The Flash Data Storage API exposes functions to manipulate files and records. Files consist of one or more records, which contain the actual data.

    Every record is identified by a key and assigned to a file through the file ID. Files are basically groups of records. Neither record keys nor file IDs must be unique, and files can contain several records with the same key. Records can be accessed through any combination of file ID and record key.

    For example, an application could use the following two files:

    • File 1 with two records: 0x1111="Phone1", 0x2222="data: 12345"
    • File 2 with three records: 0x1111="Tablet1", 0x2222="data: abcdef", 0x2222="data: 67890"

    You could then iterate, for example, through all records in file 1, through all records with key 0x1111, or through all records with key 0x2222 in file 2.

    Best regards,
    Jørgen

Reply
  • Hi,

    I think this is well explained in the documentation:

    The Flash Data Storage API exposes functions to manipulate files and records. Files consist of one or more records, which contain the actual data.

    Every record is identified by a key and assigned to a file through the file ID. Files are basically groups of records. Neither record keys nor file IDs must be unique, and files can contain several records with the same key. Records can be accessed through any combination of file ID and record key.

    For example, an application could use the following two files:

    • File 1 with two records: 0x1111="Phone1", 0x2222="data: 12345"
    • File 2 with three records: 0x1111="Tablet1", 0x2222="data: abcdef", 0x2222="data: 67890"

    You could then iterate, for example, through all records in file 1, through all records with key 0x1111, or through all records with key 0x2222 in file 2.

    Best regards,
    Jørgen

Children
Related