Skip to content

Commit d4e96c3

Browse files
authored
Merge pull request #16 from Cumulo/fix-reset
fix reset entries
2 parents 792bdd5 + 2e46641 commit d4e96c3

File tree

6 files changed

+292
-176
lines changed

6 files changed

+292
-176
lines changed

calcit.cirru

+104-1
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@
14371437
|r $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1592323714536) (:text |assoc) (:id |BMW-UUNFDG_J)
14381438
|v $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1592323714536) (:text |:loop) (:id |SQSGDko9ltPH)
14391439
|x $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1592323714536) (:text |0) (:id |HReJR_GzzB84)
1440-
|y $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1592323714536) (:text |:caches) (:id |jR94DS34z14D)
1440+
|y $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167811395) (:text |:entries) (:id |jR94DS34z14D)
14411441
|yT $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1592323714536)
14421442
:data $ {}
14431443
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1592323714536) (:text |{}) (:id |iZ6MLPCoKJfw)
@@ -1902,6 +1902,109 @@
19021902
:id |FezFIqMZHN
19031903
:id |Twiqewm6o
19041904
:id |gnShhYOpW3
1905+
|test-reset $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167721621)
1906+
:data $ {}
1907+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167728836) (:text |deftest) (:id |u_XRc0YKCu)
1908+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167721621) (:text |test-reset) (:id |RhCPsT4DRS)
1909+
|r $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1910+
:data $ {}
1911+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |let) (:id |x1Y1vrKEy5)
1912+
|w $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167771309)
1913+
:data $ {}
1914+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167771309) (:text |testing) (:id |v1vxQCDsf2)
1915+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167784765) (:text "|\"should have some entries") (:id |nMHVnxHHl2)
1916+
|r $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167771309)
1917+
:data $ {}
1918+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167771309) (:text |is) (:id |VKus52ZgfR)
1919+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167771309)
1920+
:data $ {}
1921+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167790084) (:text |pos?) (:id |3XC24Z6oIP)
1922+
|r $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167771309)
1923+
:data $ {}
1924+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167771309) (:text |count) (:id |JOpYqKtLgk)
1925+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167771309)
1926+
:data $ {}
1927+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167771309) (:text |:entries) (:id |C89hhN2ekS)
1928+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167771309) (:text |@*states) (:id |b3BpJhvmny)
1929+
:id |W7UfAOZe_V
1930+
:id |riAcpEGgwA
1931+
:id |utKpbEtduL
1932+
:id |571DJm0jRz
1933+
:id |z31U7mWlJ8
1934+
|yT $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1935+
:data $ {}
1936+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |testing) (:id |SECU09sT7rN)
1937+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text "|\"should have two entries") (:id |Sswrnr79aa5)
1938+
|r $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1939+
:data $ {}
1940+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |is) (:id |PrAogddXP5b)
1941+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1942+
:data $ {}
1943+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167801710) (:text |zero?) (:id |SS6BdpE-_o9)
1944+
|r $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1945+
:data $ {}
1946+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |count) (:id |L851Nmd8idE)
1947+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1948+
:data $ {}
1949+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |:entries) (:id |M1O889xmZ8R)
1950+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |@*states) (:id |wbpY5YB_4aU)
1951+
:id |dYwbeuD4Z9T
1952+
:id |u5LDKN3L0Oh
1953+
:id |mAvE9Uz_JZO
1954+
:id |bxwlAJ9QLDI
1955+
:id |RCUqYUMVgRd
1956+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1957+
:data $ {}
1958+
|T $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1959+
:data $ {}
1960+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |*states) (:id |KncEUBD04G)
1961+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1962+
:data $ {}
1963+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |atom) (:id |8yra7sFEQL)
1964+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1965+
:data $ {}
1966+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |memof/new-states) (:id |AJ34QrzERi)
1967+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1968+
:data $ {}
1969+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |{}) (:id |6iQPj3MZHm)
1970+
:id |NWM1hOF5i-
1971+
:id |5y2i1FEyOm
1972+
:id |Emz1e5LLxe
1973+
:id |lDYiysDUnk
1974+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1975+
:data $ {}
1976+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |f1) (:id |KHI5hXQiYt)
1977+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1978+
:data $ {}
1979+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |fn) (:id |iKJ55hRysAX)
1980+
|j $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1981+
:data $ {}
1982+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |x) (:id |xv3-oPIACHM)
1983+
:id |PdZRBrKvQC6
1984+
|r $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |x) (:id |JT_ep2iaqf-)
1985+
:id |etTjOh5CuAo
1986+
:id |VtDDbw4alB
1987+
:id |_ZTMaFQrD1
1988+
|y $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167729825)
1989+
:data $ {}
1990+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167741818) (:text |memof/reset-entries!) (:id |eeVJEpPPmWg)
1991+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167729825) (:text |*states) (:id |3-Sw8Z2JcD2)
1992+
:id |N-8xiKSoFJ_
1993+
|u $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167758645)
1994+
:data $ {}
1995+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |memof/write-record!) (:id |bCVDIBarPf)
1996+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |*states) (:id |bi6w18U5lX)
1997+
|r $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |f1) (:id |s9qXQS5Etq)
1998+
|v $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1600167758645)
1999+
:data $ {}
2000+
|T $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |[]) (:id |eBmvnRRMjM)
2001+
|j $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |1) (:id |a6C3LX5wRr)
2002+
|r $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |2) (:id |uhEiSmznas)
2003+
:id |k-UapPPArR
2004+
|x $ {} (:type :leaf) (:by |yeKFqj7rX) (:at 1600167758645) (:text |3) (:id |x6dpN2NaK_)
2005+
:id |7AT3x83uVl
2006+
:id |M6ryK4AnNr
2007+
:id |NnfS0FOShZ
19052008
:proc $ {} (:type :expr) (:by |yeKFqj7rX) (:at 1594475851792) (:data $ {}) (:id |ECAIs9K-n5)
19062009
:configs $ {}
19072010
:configs $ {} (:storage-key |calcit.cirru) (:local-storage-key |calcit-storage) (:extension |.cljs) (:output |src) (:port 6001)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"author": "jiyinyiyong <[email protected]>",
1313
"license": "MIT",
1414
"devDependencies": {
15-
"shadow-cljs": "^2.10.17",
15+
"shadow-cljs": "^2.11.4",
1616
"source-map-support": "^0.5.19",
1717
"ws": "^7.3.1"
1818
}

release.edn

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{:version "0.2.1",
1+
{:version "0.2.2-a1",
22
:group-id "cumulo",
33
:artifact-id "memof",
44
:skip-tag true,

src/memof/core.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108
(defn reset-entries! [*states]
109109
(println "[Memof] reset.")
110-
(swap! *states assoc :loop 0 :caches {}))
110+
(swap! *states assoc :loop 0 :entries {}))
111111

112112
(defn show-summary [states]
113113
(let [states (if (satisfies? IAtom states)

src/memof/test.cljs

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
"used record should kept after GC"
1414
(is (some? (memof/access-record *states f1 [1 2]))))))
1515

16+
(deftest
17+
test-reset
18+
(let [*states (atom (memof/new-states {})), f1 (fn [x] x)]
19+
(memof/write-record! *states f1 [1 2] 3)
20+
(testing "should have some entries" (is (pos? (count (:entries @*states)))))
21+
(memof/reset-entries! *states)
22+
(testing "should have two entries" (is (zero? (count (:entries @*states)))))))
23+
1624
(deftest
1725
test-write
1826
(let [*states (atom (memof/new-states {})), f1 (fn [x] x), f2 (fn [x] x)]

0 commit comments

Comments
 (0)