Skip to content

Commit

Permalink
Correct directory reader
Browse files Browse the repository at this point in the history
  • Loading branch information
dspearson committed May 29, 2023
1 parent 8e60c2a commit 7fe5faf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/phlegyas/sql/nodes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
create table nodes (
parent blob not null,
handler text not null,
dev integer not null default 0,
type integer not null,
vers integer not null,
path blob primary key,
Expand All @@ -23,6 +24,7 @@ create table nodes (
-- :doc Inserts node
insert into nodes (parent,
handler,
dev,
type,
vers,
path,
Expand All @@ -36,6 +38,7 @@ insert into nodes (parent,
muid)
values (:parent,
:handler,
:dev,
:qid-type,
:qid-vers,
:qid-path,
Expand Down
12 changes: 3 additions & 9 deletions src/phlegyas/sqlitefs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
(let [uuid (uuid!)
birth (epoch!)]
{:qid-path uuid
:dev 0
:handler handler
:qid-type (:dir qt-mode)
:qid-vers 0
Expand Down Expand Up @@ -110,7 +111,6 @@
last-path nil
data-size 0
paths-remaining (get-directory-contents system directory)]
(println "iterating")
(cond
(> data-size max-size)
[(-> accum rest flatten pack)
Expand All @@ -124,14 +124,8 @@

:else
(let [stat (first paths-remaining)
_ (println "Keys:" (keys stat))
data (for [typ layout] ((get put-operation typ) (get stat typ)))]
(println "In loop")
(println "First stat:" stat)
(println "Type of data:" (type data))
(clojure.pprint/pprint data)
(println "Count:" (count data))
(println "ok")
data (for [typ layout]
((get put-operation typ) (get stat typ)))]
(recur (conj accum data)
(:qid-path stat)
(+ data-size (count data))
Expand Down
3 changes: 1 addition & 2 deletions test/phlegyas/sqlitefs_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
directory-contents (vfs/get-directory-contents system root-directory)
_ (println (first directory-contents))
dir (vfs/directory-reader system root-directory 8192)]
;; FIXME: ^ dir read fails, run in non test context to debug

(println "Dir:" dir)
(testing "Directory is successfully inserted and retrievable"
(is (uuid= (:path sub-directory-1)
(:path fetched-directory))))
Expand Down

0 comments on commit 7fe5faf

Please sign in to comment.