<commit_before>// Copyright 2014, Renasar Technologies Inc.
/* jshint: node:true */

'use strict';

var di = require('di');

module.exports = eventsProtocolFactory;

di.annotate(eventsProtocolFactory, new di.Provide('Protocol.Events'));
di.annotate(eventsProtocolFactory,
    new di.Inject(
        "Services.Messenger",
        "Services.Assert",
        "Q"
    )
);

function eventsProtocolFactory (messenger, assert, Q) {

    function EventsProtocol () {
        this.exchange = 'events';
    }

    EventsProtocol.prototype.publishTftpSuccess = function (nodeId, data) {
        assert.ok(nodeId);
        messenger.publish(this.exchange, 'tftp.success' + '.' + nodeId, data);
    };

    EventsProtocol.prototype.publishTftpFailure = function (nodeId, data) {
        assert.ok(nodeId);
        messenger.publish(this.exchange, 'tftp.failure' + '.' + nodeId, data);
    };

    EventsProtocol.prototype.publishHttpResponse = function (data) {
        messenger.publish(this.exchange, 'http.response', data);
    };


    EventsProtocol.prototype.start = function start(){
        return messenger.exchange(this.exchange, 'topic', {
            durable: true
        });
    };

    EventsProtocol.prototype.stop = function stop(){
        return Q.resolve();
    };

    return new EventsProtocol();
}
<commit_msg>add nodeid to http response event<commit_after>// Copyright 2014, Renasar Technologies Inc.
/* jshint: node:true */

'use strict';

var di = require('di');

module.exports = eventsProtocolFactory;

di.annotate(eventsProtocolFactory, new di.Provide('Protocol.Events'));
di.annotate(eventsProtocolFactory,
    new di.Inject(
        'Services.Messenger',
        'Services.Assert',
        'Q'
    )
);

function eventsProtocolFactory (messenger, assert, Q) {

    function EventsProtocol () {
        this.exchange = 'events';
    }

    EventsProtocol.prototype.publishTftpSuccess = function (nodeId, data) {
        assert.ok(nodeId);

        messenger.publish(this.exchange, 'tftp.success' + '.' + nodeId, data);
    };

    EventsProtocol.prototype.publishTftpFailure = function (nodeId, data) {
        assert.ok(nodeId);

        messenger.publish(this.exchange, 'tftp.failure' + '.' + nodeId, data);
    };

    EventsProtocol.prototype.publishHttpResponse = function (nodeId, data) {
        assert.ok(nodeId);

        messenger.publish(this.exchange, 'http.response' + '.' + nodeId, data);
    };

    EventsProtocol.prototype.start = function start(){
        return messenger.exchange(this.exchange, 'topic', {
            durable: true
        });
    };

    EventsProtocol.prototype.stop = function stop(){
        return Q.resolve();
    };

    return new EventsProtocol();
}

{'fraction_non_alphanumeric': 0.1348563006632277, 'fraction_numerical': 0.0029476787030213707, 'mean_word_length': 3.004424778761062, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4474727', 'n_tokens_mistral': 826, 'n_tokens_neox': 775, 'n_words': 154}