Skip to content

hendrenja/driver-mnt-filestore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filestore

Store and retrieve objects in/from JSON files

Usage

The easiest way to add a filestore to your project is to add a configuration file to your project and then load this file with corto_load in your application. Here's an example that recursively persists all objects under /data, and stores the files in /tmp/myProjectStore:

filestore.json:

{
  "type": "driver/mnt/filestore/mount",
  "value": {
    "storedir": "/tmp/myProjectStore",
    "query": {
      "select": "//",
      "from": "data"
    },
    "policy.ownership": "LOCAL_OWNER"
  }
}

By setting policy.ownership to LOCAL_OWNER, objects in the store will be owned by the application. This ensures that when you restart the application, initial values from persisted objects are overwritten with the latest value from the store.

You can load this file in your application, by doing:

if (corto_load("filestore.json", 0, NULL)) {
    corto_error("%s", corto_lasterr());
}

About

Store and retrieve objects in/from JSON files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%