<commit_before>"use strict";

/**
 * Key-rev-value bucket handler
 */

var P = require('bluebird');
var uuid = require('node-uuid');
var rbUtil = require('../lib/rbUtil');
var URI = require('swagger-router').URI;

// TODO: move to separate spec package
var yaml = require('js-yaml');
var fs = require('fs');
var spec = yaml.safeLoad(fs.readFileSync(__dirname + '/key_rev_value.yaml'));

var backend;
var config;

function KRVBucket (options) {
    this.log = options.log || function(){};
}

KRVBucket.prototype.getBucketInfo = function(restbase, req, options) {
    var self = this;
    return P.resolve({
        status: 200,
        body: options
    });
};

KRVBucket.prototype.makeSchema = function (opts) {
    opts.schemaVersion = 1;
    return {
        // Associate this bucket with the table
        bucket: opts,
        options: {
            compression: [
                {
                    algorithm: 'deflate',
                    block_size: 256
                }
            ]
        },
        attributes: {
            key: opts.keyType || 'string',
            rev: 'int',
            tid: 'timeuuid',
            latestTid: 'timeuuid',
            value: opts.valueType || 'blob',
            'content-type': 'string',
            'content-sha256': 'blob',
            // redirect
            'content-location': 'string',
            tags: 'set<string>'
            //headers: 'map<string,string>'
        },<commit_msg>Remove 'bucket' property in key_rev_value schema<commit_after>"use strict";

/**
 * Key-rev-value bucket handler
 */

var P = require('bluebird');
var uuid = require('node-uuid');
var rbUtil = require('../lib/rbUtil');
var URI = require('swagger-router').URI;

// TODO: move to separate spec package
var yaml = require('js-yaml');
var fs = require('fs');
var spec = yaml.safeLoad(fs.readFileSync(__dirname + '/key_rev_value.yaml'));

var backend;
var config;

function KRVBucket (options) {
    this.log = options.log || function(){};
}

KRVBucket.prototype.getBucketInfo = function(restbase, req, options) {
    var self = this;
    return P.resolve({
        status: 200,
        body: options
    });
};

KRVBucket.prototype.makeSchema = function (opts) {
    opts.schemaVersion = 1;
    return {
        options: {
            compression: [
                {
                    algorithm: 'deflate',
                    block_size: 256
                }
            ]
        },
        attributes: {
            key: opts.keyType || 'string',
            rev: 'int',
            tid: 'timeuuid',
            latestTid: 'timeuuid',
            value: opts.valueType || 'blob',
            'content-type': 'string',
            'content-sha256': 'blob',
            // redirect
            'content-location': 'string',
            tags: 'set<string>'
            //headers: 'map<string,string>'
        },
{'fraction_non_alphanumeric': 0.14280714035701786, 'fraction_numerical': 0.007000350017500875, 'mean_word_length': 1.9312820512820512, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1640707', 'n_tokens_mistral': 840, 'n_tokens_neox': 812, 'n_words': 197}