Astroua / CARTAvis

Deprecated Repository for CARTA project. Refer to:
https://github.com/cartavis/carta
GNU General Public License v2.0
2 stars 7 forks source link

Sqlite3 and LevelDB persistent cache plugins + usage from DataSource #197

Open confluence opened 7 years ago

confluence commented 7 years ago

This pull request includes Sqlite3 and LevelDB implementations of the persistent cache API, as two separate plugins (cherry-picked and adapted from @pfederl's code).

It also adds calls to this API from the quantile-finding functions used in DataSource.

Each plugin needs a parent directory for the database file to be specified in the configuration file (~/.cartavis/config.json). One of the plugins can also be explicitly disabled in the configuration so that the other plugin is used. E.g.:

{ "disabledPlugins" : [ "PCacheSqlite3" ],

"plugins": {
    "PCacheSqlite3" : {
        "dbDir": "/tmp"
    },
    "PCacheLevelDB" : { 
        "dbDir": "/tmp"
    }
}

}

confluence commented 7 years ago

I have changed the format of the config -- now the full path to the database file / directory is specified, not the parent directory. This makes it easier to override the location of the database from the unit tests. This is the new format:

"PCacheSqlite3" : {
    "dbPath": "/tmp/pcache.sqlite"
},
"PCacheLevelDB" : { 
    "dbPath": "/tmp/pcache.leveldb"
}