MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / rdbLoadFile

Function rdbLoadFile

src/rdb.cpp:3578–3590  ·  view source on GitHub ↗

Like rdbLoadRio() but takes a filename instead of a rio stream. The * filename is open for reading and a rio stream object created in order * to do the actual loading. Moreover the ETA displayed in the INFO * output is initialized and finalized. * * If you pass an 'rsi' structure initialied with RDB_SAVE_OPTION_INIT, the * loading code will fiil the information fields in the structure. */

Source from the content-addressed store, hash-verified

3576 * If you pass an 'rsi' structure initialied with RDB_SAVE_OPTION_INIT, the
3577 * loading code will fiil the information fields in the structure. */
3578int rdbLoadFile(const char *filename, rdbSaveInfo *rsi, int rdbflags) {
3579 FILE *fp;
3580 rio rdb;
3581 int retval;
3582
3583 if ((fp = fopen(filename,"r")) == NULL) return C_ERR;
3584 startLoadingFile(fp, filename,rdbflags);
3585 rioInitWithFile(&rdb,fp);
3586 retval = rdbLoadRio(&rdb,rdbflags,rsi);
3587 fclose(fp);
3588 stopLoading(retval==C_OK);
3589 return retval;
3590}
3591
3592/* A background saving child (BGSAVE) terminated its work. Handle this.
3593 * This function covers the case of actual BGSAVEs. */

Callers 3

rdbLoadFunction · 0.85
readSyncBulkPayloadRdbFunction · 0.85
debugCommandFunction · 0.85

Calls 4

startLoadingFileFunction · 0.85
rioInitWithFileFunction · 0.85
rdbLoadRioFunction · 0.85
stopLoadingFunction · 0.85

Tested by

no test coverage detected