Commit c192083d authored by Eric Timmons's avatar Eric Timmons
Browse files

CLPI separates index from object store now

parent bf758b88
......@@ -25,8 +25,10 @@
:uri ql-dist-uri
:cache-pathname ql-cache-dir
:http-client http-client))
(index (make-instance 'clpi:file-index
:root clpi-dir)))
(index (make-instance 'ql-clpi:ql-index
:object-store
(make-instance 'clpi:file-object-store
:root clpi-dir))))
(ql-dist-to-clpi ql-dist index :appendable-p appendable-p)
index))
......
......@@ -6,10 +6,7 @@
(uiop:define-package #:ql-clpi/ql-clpi-index
(:use #:cl)
(:import-from #:clpi)
(:export #:ql-dual-index
#:ql-file-index
#:ql-http-index
#:ql-index
(:export #:ql-index
#:ql-index-latest-version-synced
#:ql-project-version-aliases))
......@@ -23,18 +20,9 @@
:initarg :latest-version-synced
:accessor ql-index-latest-version-synced)))
(defclass ql-file-index (ql-index clpi:file-index)
())
(defclass ql-http-index (ql-index clpi:http-index)
())
(defclass ql-dual-index (ql-index clpi:dual-index)
())
(defmethod slot-unbound (class (index ql-index) (slot-name (eql 'latest-version-synced)))
(clpi:with-open-index-object-stream (s index "ext/ql/latest-version-synced"
:if-does-not-exist nil)
(clpi:with-open-object-stream (s (clpi:index-object-store index) "ext/ql/latest-version-synced"
:if-does-not-exist nil)
(setf (ql-index-latest-version-synced index)
(when s
(clpi:with-clpi-io-syntax ()
......@@ -42,9 +30,9 @@
(defmethod clpi:index-save :after ((index ql-index))
(when (slot-boundp index 'latest-version-synced)
(clpi:with-open-index-object-stream (s index "ext/ql/latest-version-synced"
:direction :output
:if-exists :supersede)
(clpi:with-open-object-stream (s (clpi:index-object-store index) "ext/ql/latest-version-synced"
:direction :output
:if-exists :supersede)
(clpi:with-clpi-io-syntax ()
(write (ql-index-latest-version-synced index) :stream s)
(terpri s)))))
......@@ -52,6 +40,14 @@
(defmethod clpi:index-project-class ((index ql-index))
'ql-project)
(defmethod clpi:index-sync :after ((index ql-index))
(let ((object-store (clpi:index-object-store index)))
(when (typep object-store 'clpi:dual-object-store)
(clpi:dual-object-store-update-object object-store "ext/ql/latest-version-synced")
(dolist (p (clpi:index-projects index))
(clpi:dual-object-store-update-object object-store
(clpi:project-object-path p "ext/ql/version-aliases"))))))
;; * Projects
......@@ -61,10 +57,9 @@
:accessor ql-project-version-aliases)))
(defmethod slot-unbound (class (project ql-project) (slot-name (eql 'version-aliases)))
(clpi:with-open-index-object-stream (s (clpi:index project) (clpi:project-object-path
project
"ext/ql/version-aliases")
:if-does-not-exist nil)
(clpi:with-open-object-stream (s (clpi:index-object-store (clpi:index project))
(clpi:project-object-path project "ext/ql/version-aliases")
:if-does-not-exist nil)
(setf (ql-project-version-aliases project)
(when s
(clpi:with-clpi-io-syntax ()
......@@ -72,10 +67,10 @@
(defmethod clpi:project-save :after ((project ql-project))
(when (slot-boundp project 'version-aliases)
(clpi:with-open-index-object-stream (s (clpi:index project)
(clpi:project-object-path project "ext/ql/version-aliases")
:direction :output
:if-exists :supersede)
(clpi:with-open-object-stream (s (clpi:index-object-store (clpi:index project))
(clpi:project-object-path project "ext/ql/version-aliases")
:direction :output
:if-exists :supersede)
(clpi:with-clpi-io-syntax ()
(write (ql-project-version-aliases project) :stream s)
(terpri s)))))
......@@ -14,9 +14,7 @@
(:import-from #:clpi)
(:export #:ql-dist
#:ql-dist-to-clpi
#:ql-dual-index
#:ql-file-index
#:ql-http-index
#:ql-index
#:project-version-aliases))
(in-package #:ql-clpi/ql-clpi)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment