Coverage report: /home/ellis/comp/core/app/packy/proto.lisp

KindCoveredAll%
expression060 0.0
branch04 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; proto.lisp --- Packy Protocol
2
 
3
 ;; 
4
 
5
 ;;; Code:
6
 (in-package :packy)
7
 
8
 (define-condition packy-condition () ())
9
 (deferror packy-error (simple-error packy-condition) () (:auto t))
10
 
11
 (defclass package-id (id)
12
   ((id :initform (make-array 16 :element-type 'octet) :initarg :id :type (octet-vector 16) :accessor id)))
13
 
14
 (defmethod make-id ((kind (eql :package)))
15
   (make-instance 'package-id))
16
 
17
 (defmethod make-random-id ((kind (eql :package)))
18
   (let ((l))
19
     (dotimes (i 16) (push (random 255) l))
20
     (let ((v (make-array 16 :element-type 'octet
21
                             :initial-contents l)))
22
       (make-instance 'package-id :id v))))
23
     
24
 (defmethod print-object ((self package-id) stream)
25
   (print-unreadable-object (self stream)
26
     (format stream "~A" (octet-vector-to-hex-string (id self)))))
27
 
28
 (defclass package-stream (pack io-stream) ())
29
 
30
 (defclass compressed-package (package-stream decompressing-stream) ())
31
 
32
 (defclass file-package (package-stream file-stream) ())
33
 
34
 (defclass directory-package (package-stream)
35
   ((directory :initarg :directory :accessor dir)))
36
 
37
 (defun packed-path-p (path)
38
   "Return non-nil if PATH is a ZSTD compressed file or otherwise complete
39
 package-descriptor."
40
   (and (probe-file path) (equal "zst" (pathname-type path))))
41
 
42
 (defgeneric pack (self &key &allow-other-keys)
43
   (:method ((self pathname) &key)
44
     (when (packed-path-p self)
45
       (packy-error "Package is already compressed: ~A" self))))
46
 
47
 (defgeneric unpack (self &key &allow-other-keys))
48
 (defgeneric install-package (self &key &allow-other-keys))
49
 (defgeneric uninstall-package (self &key &allow-other-keys))
50
 (defgeneric update-package (self &key &allow-other-keys))
51
 (defgeneric push-package (self &key &allow-other-keys))
52
 (defgeneric pull-package (self &key &allow-other-keys))
53
 (defgeneric query-package (self &key &allow-other-keys))
54
 (defgeneric sync-package (self &key &allow-other-keys))
55
 (defgeneric build-package (self &key &allow-other-keys))
56
 (defgeneric prepare-package (self &key &allow-other-keys))
57
 (defgeneric check-package (self &key &allow-other-keys))
58
 (defgeneric package-version (self &key &allow-other-keys))