<commit_before>var service = require('./lib/service'),
    config = {};

exports.register = function(plugin, options, next){
  config = options;

  plugin.log(["discovery"], "registering discovery routes");
  plugin.route([
    {
      method: "GET",
      path: "/discovery/announce",
      config: {
        handler: function(request, reply){
          service.announce(function(err){
            if(err){
                return reply(err);
            }

            reply();
          });
        }
      }
    },
    {
      method: "GET",
      path: "/discovery/unannounce",
      config: {
        handler: function(request, reply){
          service.unannounce(function(err){
            if(err){
              return reply(err);
            }
            reply();
          });
        }
      }
    },
    {
      method: "GET",
      path: "/discovery/lease",
      config: {
        handler: function(request, reply){
          var lease = service.lease();
          if(!lease){
            return reply().code(404);
          }

          reply(lease);
        }
      }
    },
    {
      method: "GET",
      path: "/discovery/lastUpdate",
      config: {
        handler: function(request, reply){
          reply({ lastUpdate: service.lastUpdate().toISOString() });
        }
      }
    }
  ]);

  service.init(plugin, config, function(){
    next();
  });
};

exports.register.attributes = {
  pkg: require('./package.json')
};
<commit_msg>expose the announce function<commit_after>var service = require('./lib/service'),
    config = {};

exports.register = function(plugin, options, next){
  config = options;

  plugin.log(["discovery"], "registering discovery routes");
  plugin.route([
    {
      method: "GET",
      path: "/discovery/announce",
      config: {
        handler: function(request, reply){
          service.announce(function(err){
            if(err){
                return reply(err);
            }

            reply();
          });
        }
      }
    },
    {
      method: "GET",
      path: "/discovery/unannounce",
      config: {
        handler: function(request, reply){
          service.unannounce(function(err){
            if(err){
              return reply(err);
            }
            reply();
          });
        }
      }
    },
    {
      method: "GET",
      path: "/discovery/lease",
      config: {
        handler: function(request, reply){
          var lease = service.lease();
          if(!lease){
            return reply().code(404);
          }

          reply(lease);
        }
      }
    },
    {
      method: "GET",
      path: "/discovery/lastUpdate",
      config: {
        handler: function(request, reply){
          reply({ lastUpdate: service.lastUpdate().toISOString() });
        }
      }
    }
  ]);

  service.init(plugin, config, function(){
    next();
  });
};

exports.register.attributes = {
  pkg: require('./package.json')
};

exports.announce = function(cb){
  service.announce(cb);
}

{'fraction_non_alphanumeric': 0.15358931552587646, 'fraction_numerical': 0.002003338898163606, 'mean_word_length': 1.632688927943761, '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': '7495555', 'n_tokens_mistral': 861, 'n_tokens_neox': 834, 'n_words': 154}