summaryrefslogtreecommitdiff
path: root/src/bgpstore.lisp
blob: 7430b8a9fd3e3266fbd5dcffa9d17a34e8c9a17c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-

(defparameter *db-spec* '("bgpstore" "bgpstore" "bgpstore" "localhost" ))

(defun marker (mark)
  (format t mark)
  (force-output))

(defun start-bgpstore (host port)
  (with-connection *db-spec* 
    (let ((reader (new-reader host port))
	  (count 0))
      (marker (format nil "~A: bgpstore started "
		      (iso-date (get-universal-time) t)))
      (do ((e (next-xml-blurb reader "BGP_MESSAGE")
	      (next-xml-blurb reader "BGP_MESSAGE")))
	  ((null e))
	(dolist (obj (new-entries (xml-top-elem-from-octets e)))
	  (insert-dao obj)
	  (incf count)
	  (when (= 0 (mod count 10)) (marker "."))
	  (when (= 0 (mod count 100)) (marker "+"))
	  (when (= 0 (mod count 1000))
	    (marker (format nil "~%~A: ~A "
			    (iso-date (get-universal-time) t)
			    count)))))
      (close-reader))))

(defun stop-bgpstore ())