lib/safeFile.js
function getState (file) {
    // collect state for all possible data and recovery files
    var state = {};
    state.ephemeral = getFileInfo (file + ".eph");
    state.ready = getFileInfo (file + ".rdy");
    state.base = getFileInfo (file);
    state.backup = getFileInfo (file + ".bak");
    state.tertiary = getFileInfo (file + ".bk2");

    if (state.ephemeral.exists) {
        state.status = cc.SAFE_INTERVENE;
    } else if ((state.ready.exists) || (state.tertiary.exists)) {
        state.status = cc.SAFE_RECOVERABLE;
    } else if (state.base.exists) {
        state.status = cc.SAFE_NORMAL;
    } else {
        if (state.backup.exists) {
            state.status = cc.SAFE_RECOVERABLE;
        } else {
            state.status = cc.DOES_NOT_EXIST;
        }
    }

    return (state);
}
function getState (file) {
    // collect state for all possible data and recovery files
    var state = {};
    state.ephemeral = getFileInfo (file + ".eph");
    state.ready = getFileInfo (file + ".rdy");
    state.base = getFileInfo (file);
    state.backup = getFileInfo (file + ".bak");
    state.tertiary = getFileInfo (file + ".bk2");

    if (state.ephemeral.exists) {
        state.status = cc.SAFE_INTERVENE;
    } else if ((state.ready.exists) || (state.tertiary.exists)) {
        state.status = cc.SAFE_RECOVERABLE;
    } else if (state.base.exists) {
        state.status = cc.SAFE_NORMAL;
    } else {
        if (state.backup.exists) {
            state.status = cc.SAFE_RECOVERABLE;
        } else {
            state.status = cc.DOES_NOT_EXIST;
        }
    }

    return (state);
}
function getState ( file ) { // collect state for all possible data and recovery files var state = { } ; state . ephemeral = getFileInfo ( file + ".eph" ) ; state . ready = getFileInfo ( file + ".rdy" ) ; state . base = getFileInfo ( file ) ; state . backup = getFileInfo ( file + ".bak" ) ; state . tertiary = getFileInfo ( file + ".bk2" ) ; if ( state . ephemeral . exists ) { state . status = cc . SAFE_INTERVENE ; } else if ( ( state . ready . exists ) || ( state . tertiary . exists ) ) { state . status = cc . SAFE_RECOVERABLE ; } else if ( state . base . exists ) { state . status = cc . SAFE_NORMAL ; } else { if ( state . backup . exists ) { state . status = cc . SAFE_RECOVERABLE ; } else { state . status = cc . DOES_NOT_EXIST ; } } return ( state ) ; }
Get state for file system entities.
@param {String} file Base file name.
@returns {Object} State object.
Get state for file system entities .