File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1414(defprotocol IResolve
1515 " All nodes must implement this protocol. It's includes the minimal functionality
1616 necessary to avoid resolving nodes unless strictly necessary."
17+ (index? [_] " Returns true if this is an index node" )
1718 (last-key [_] " Returns the rightmost key of the node" )
1819 (dirty? [_] " Returns true if this should be flushed" )
1920 ; ;TODO resolve should be instrumented
103104
104105(defrecord IndexNode [children storage-addr op-buf cfg]
105106 IResolve
107+ (index? [this] true )
106108 (dirty? [this] (not (realized? storage-addr)))
107109 (resolve [this] this) ; ;TODO this is a hack for testing
108110 (last-key [this]
213215
214216(defrecord DataNode [children storage-addr cfg]
215217 IResolve
218+ (index? [this] false )
216219 (resolve [this] this) ; ;TODO this is a hack for testing
217220 (dirty? [this] (not (realized? storage-addr)))
218221 (last-key [this]
Original file line number Diff line number Diff line change 2121 data2 (data-node (->Config 3 3 2 ) (sorted-map 6 6 7 7 8 8 9 9 10 10 ))
2222 root (->IndexNode [data1 data2] (promise ) [] (->Config 3 3 2 ))]
2323 (is (= (map first (lookup-fwd-iter root 4 )) (range 4 11 )))
24- (is (= (map first (lookup-fwd-iter root 0 )) (range 1 11 ))))))
24+ (is (= (map first (lookup-fwd-iter root 0 )) (range 1 11 )))))
25+
26+ (testing " index nodes identified as such"
27+ (let [data (data-node (->Config 3 3 2 ) (sorted-map 1 1 ))
28+ root (->IndexNode [data] (promise ) [] (->Config 3 3 2 ))]
29+ (is (index? root))
30+ (is (not (index? data))))))
2531
2632(defn insert-helper
2733 [t k]
You can’t perform that action at this time.
0 commit comments