Skip to content

Commit

Permalink
Remove CLSQL as a persistence backend
Browse files Browse the repository at this point in the history
It seems a good time reconsidering using CLSQL as a persistence
backend. Using readably printed objects seems a much simpler
and as efficient approach.

Using CLSQL as a persistence backend introduces a lot of coding
overhead to work nicely with joined slots.  This certainly could be
delegated to a macro but that approach requires to build up a solid
knowledge of CLSQL internals around joined slots as well as taking a
lot of architectural decisions — like defining methods for
CLSQL:UPDATE-RECORDS-FROM-INSTANCE that also work on prerequisites of
a resource, thus modifying the usual semantic of the method, or
introducing CID specific methods to expose the fucntionality to the
user.

Using readably printed objects is a lightweight approach to
persistence. It however hinders our capacity to easily study
resources transversally to infrastructure stacks. Questions such as
“How many underlying resources are common in two infrastructure
stacks” or “Would destroying an infrastructure stack have consequences
for another infrastructure stack?” cannot be as easily answered
without a SQL persistence backend. These questions are however a
secondary target.
  • Loading branch information
foretspaisibles committed May 6, 2024
1 parent 4e0292f commit ff3b1c5
Show file tree
Hide file tree
Showing 25 changed files with 322 additions and 746 deletions.
1 change: 1 addition & 0 deletions doc/project.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ lifetime, common users and stakeholders.
@include include/fun-org.melusina.cid-find-project.texinfo
@include include/fun-org.melusina.cid-list-projects.texinfo
@include include/var-org.melusina.cid-star-project-star.texinfo
@include include/var-org.melusina.cid-star-project-directory-star.texinfo
1 change: 0 additions & 1 deletion doc/steward.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ project.

@include include/class-org.melusina.cid-steward.texinfo
@include include/fun-org.melusina.cid-configure-steward.texinfo
@include include/fun-org.melusina.cid-find-steward.texinfo
1 change: 1 addition & 0 deletions doc/tenant.texinfo
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ teams, and so on.
@include include/fun-org.melusina.cid-find-tenant.texinfo
@include include/fun-org.melusina.cid-list-tenants.texinfo
@include include/var-org.melusina.cid-star-tenant-star.texinfo
@include include/var-org.melusina.cid-star-tenant-directory-star.texinfo
30 changes: 1 addition & 29 deletions libexec/lisp/development.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#:lint
#+quicklisp
#:reload
#:build
#:browse-database
#:recreate-database))
#:build))

(in-package #:org.melusina.cid/development)

Expand Down Expand Up @@ -85,32 +83,6 @@
(setf (build:image-tag image) tag)
(build:build-image image :cache cache))))

(defvar *database-browser* nil
"The launched program browsing the database.")

(defun browse-database ()
"Browse the currently connected database."
(when (and *database-browser* (uiop:process-alive-p *database-browser*))
(error "A database browser has already been spawned."))
(when (and clsql:*default-database*
(eq (clsql:database-type clsql:*default-database*)
:sqlite3))
(let ((pathname
(first (clsql-sys:connection-spec clsql:*default-database*))))
(setf *database-browser*
(uiop:launch-program
(list "sqlitebrowser" (namestring pathname)))))))

(defun recreate-database ()
(when (and clsql:*default-database*
(eq (clsql:database-type clsql:*default-database*)
:sqlite3))
(let ((pathname
(first (clsql-sys:connection-spec clsql:*default-database*))))
(cid:disconnect-database)
(delete-file pathname)
(cid:connect-database))))


;;;;
;;;; Command Stock
Expand Down
17 changes: 1 addition & 16 deletions org.melusina.cid.asd
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,18 @@
;;;; you should have received as part of this distribution. The terms
;;;; are also available at https://opensource.org/licenses/MIT

(asdf:defsystem #:org.melusina.cid/clsql-extension
:description "CLSQL Extensions for El Cid"
:author "Michaël Le Barbier"
:license "MIT License"
:depends-on (#:clsql)
:components
((:module "src"
:components
((:file "clsql-extension")))))

(asdf:defsystem #:org.melusina.cid
:description "Continuous Integration and Delivery"
:author "Michaël Le Barbier"
:license "MIT License"
:depends-on (#:alexandria
#:cl-ppcre
#:clsql
#:clsql-sqlite3
#:ironclad
#:yason
#:org.melusina.cid/clsql-extension)
#:yason)
:components
((:module "src"
:components ((:file "package")
(:file "utilities")
(:file "database")
(:module "traits"
:components ((:file "named")))
(:file "tenant")
Expand Down Expand Up @@ -142,7 +128,6 @@
((:module "testsuite"
:components ((:file "package")
(:file "utilities")
(:file "database")
(:file "tenant")
(:file "project")
(:file "steward")
Expand Down
30 changes: 0 additions & 30 deletions src/clsql-extension.lisp

This file was deleted.

60 changes: 0 additions & 60 deletions src/database.lisp

This file was deleted.

9 changes: 3 additions & 6 deletions src/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,24 @@
(:use #:common-lisp)
(:export

;; Database
#:*database-type*
#:*database-connection-spec*
;; Utilities
#:user-data-relative-pathname
#:connect-database
#:disconnect-database
#:with-database
;; Common Accessors
#:description
;; Named Trait
#:name
#:displayname
;; Tenant
#:*tenant*
#:*tenant-directory*
#:tenant
#:tenant-name
#:list-tenants
#:make-tenant
#:find-tenant
;; Project
#:*project*
#:*project-directory*
#:project
#:project-name
#:list-projects
Expand Down
Loading

0 comments on commit ff3b1c5

Please sign in to comment.