<commit_before>'use strict';

const path      = require('path');
const defaults  = require('defa');
const Sequelize = require('sequelize');

class Index {

    constructor(options) {

        defaults(options, {
            'filename': () => path.join(process.cwd(), '.index')
        });

        this.prepareDb(options.filename);
    }

    sync() {
        if (!this.ready)
            this.ready = this.Result.sync();

        return this.ready;
    }

    log(msg) {
        // do nothing
    }

    /**
     * Prepare the database and insert models and stuff
     * @param {String} filename
     * @returns {Promise}
     */
    prepareDb(filename) {

        const sequelize = new Sequelize('cachething', 'carrier', null, {
            'dialect': 'sqlite',
            'storage': filename,
            'logging': msg => this.log(msg)
        });

        this.db = sequelize;

        this.Result = sequelize.define('Result', {
            action:     Sequelize.STRING,
            fileHash:   Sequelize.STRING,
            outputHash: Sequelize.STRING,
            created:    Sequelize.BIGINT,
            expires:    Sequelize.BIGINT,
            fileName:   Sequelize.STRING,
            compressed: Sequelize.BOOLEAN,
            fileSize:   Sequelize.BIGINT,
            runtime:    Sequelize.BIGINT
        });
    }
}

module.exports = Index;<commit_msg>Fix lint error<commit_after>'use strict';

const path      = require('path');
const defaults  = require('defa');
const Sequelize = require('sequelize');

class Index {

    constructor(options) {

        defaults(options, {
            'filename': () => path.join(process.cwd(), '.index')
        });

        this.prepareDb(options.filename);
    }

    sync() {
        if (!this.ready)
            this.ready = this.Result.sync();

        return this.ready;
    }

    log() {
        // do nothing
    }

    /**
     * Prepare the database and insert models and stuff
     * @param {String} filename
     * @returns {Promise}
     */
    prepareDb(filename) {

        const sequelize = new Sequelize('cachething', 'carrier', null, {
            'dialect': 'sqlite',
            'storage': filename,
            'logging': msg => this.log(msg)
        });

        this.db = sequelize;

        this.Result = sequelize.define('Result', {
            action:     Sequelize.STRING,
            fileHash:   Sequelize.STRING,
            outputHash: Sequelize.STRING,
            created:    Sequelize.BIGINT,
            expires:    Sequelize.BIGINT,
            fileName:   Sequelize.STRING,
            compressed: Sequelize.BOOLEAN,
            fileSize:   Sequelize.BIGINT,
            runtime:    Sequelize.BIGINT
        });
    }
}

module.exports = Index;
{'fraction_non_alphanumeric': 0.12646198830409358, 'fraction_numerical': 0.0, 'mean_word_length': 1.7843336724313326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3975712', 'n_tokens_mistral': 820, 'n_tokens_neox': 794, 'n_words': 161}