var url = require("url");
var path = require("path");
-function maintainCache() {
- // TODO i should check that im already running here and exit if i am
- console.log("Cache maintainence routine starting...");
- console.log("Cache maintainence routine ended...");
-}
-
-exports.startTimer = function() {
- // our once-a-day cache maintainer
- var cacheTimer = global.repoproxy.scancache*3600*1000;
- //var cacheTimer = global.repoproxy.scancache*100;
- setInterval(maintainCache, cacheTimer);
-}
-
function upstreamRequest(unify) {
// first do a head request
console.log("upsteram as ", unify.requestFor);
--- /dev/null
+var fs = require("fs");
+var http = require("http");
+var url = require("url");
+var path = require("path");
+var repoapt = require("./repo-apt.js");
+var repoyum = require("./repo-yum.js");
+
+function maintainCache() {
+ // TODO i should check that im already running here and exit if i am
+ console.log("Cache maintainence routine starting...");
+ for(var index in global.repoproxy.repo) {
+ console.log("start cleanup in ", index);
+ console.log("cleanup array ", global.repoproxy.repo[index]);
+ switch(global.repoproxy.repo[index]["type"]) {
+ case "apt":
+ console.log("Scanning '%s' as apt", index);
+ repoapt.maintain(global.repoproxy.repo[index]);
+ break;
+ case "yum":
+ console.log("Scanning '%s' as apt", index);
+ repoyum.maintain(global.repoproxy.repo[index]);
+ break;
+ }
+ }
+ console.log("Cache maintainence routine ended...");
+}
+
+exports.startTimer = function() {
+ // our once-a-day cache maintainer
+ var cacheTimer = global.repoproxy.scancache*3600*1000;
+ //var cacheTimer = global.repoproxy.scancache*100;
+ maintainCache();
+ setInterval(maintainCache, cacheTimer);
+}
+
+function cleanupRoutine() {
+
+}
\ No newline at end of file
--- /dev/null
+function maintain(details) {
+ console.log("doing apt clean for ", details);
+}
+
+exports.maintain = maintain;
\ No newline at end of file
--- /dev/null
+function maintain(details) {
+ console.log("doing yum clean for ", details);
+}
+
+exports.maintain = maintain;
\ No newline at end of file
var config = require("./lib/config.js");
var router = require("./lib/router.js");
var cache = require("./lib/cache.js");
+var maintain = require("./lib/maintain.js");
// first we load the config...
console.log("Starting cache maintenance timer");
-cache.startTimer();
+maintain.startTimer();
// next we start our main request loop
http.createServer(router.routeRequest).listen(global.repoproxy.listenPort);