How does one create a DataStoreSnapshot for a custom data store ?

The WWDC2024 custom data store example doesn't provide any details on how one would go about creating a DataStoreSnapshot. The example uses a DefaultSnapshot for persisting the data in the DefaultSnapshot format directly in the JSON file.

There appears to be no documentation or examples of how one might create a DataStoreSnapshot from data from another database.

The Apple documentation for DefaultSnapshot provides no examples of how one might create such a snapshot from data retrieved elsewhere.

Can anyone provide a simple example of how one might create such a snapshot from a remote database such that it can be returned as part of the response to a fetch request.

For the purpose of this example let's assume I have a CSV file with rows of data and code to read the data from this file. How would I create a snapshot or snapshots for each of the rows of data.

How does one create a DataStoreSnapshot for a custom data store ?
 
 
Q