diff --git a/extra/store/authors.txt b/extra/store/authors.txt deleted file mode 100644 index 7c1b2f2279..0000000000 --- a/extra/store/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/extra/store/blob/authors.txt b/extra/store/blob/authors.txt deleted file mode 100755 index 7c1b2f2279..0000000000 --- a/extra/store/blob/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/extra/store/blob/blob.factor b/extra/store/blob/blob.factor deleted file mode 100644 index 9cec77c6c2..0000000000 --- a/extra/store/blob/blob.factor +++ /dev/null @@ -1,22 +0,0 @@ -! Copyright (C) 2006 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: assocs kernel io io.files namespaces serialize ; -IN: store.blob - -: (save-blob) serialize ; - -: save-blob ( obj path -- ) - [ (save-blob) ] with-stream ; - -: (load-blob) ( path -- seq/f ) - dup exists? [ - [ - deserialize-sequence - ] with-stream - ] [ - drop f - ] if ; - -: load-blob ( path -- seq/f ) - resource-path (load-blob) ; - diff --git a/extra/store/store-tests.factor b/extra/store/store-tests.factor deleted file mode 100644 index 6f33d66101..0000000000 --- a/extra/store/store-tests.factor +++ /dev/null @@ -1,35 +0,0 @@ -USING: assocs continuations debugger io.files kernel -namespaces store tools.test ; -IN: temporary - -SYMBOL: store -SYMBOL: foo - -: the-store ( -- path ) - "store-test.store" resource-path ; - -: delete-the-store ( -- ) - [ the-store delete-file ] catch drop ; - -: load-the-store ( -- ) - the-store load-store store set-global ; - -: save-the-store ( -- ) - store save-store ; - -delete-the-store -load-the-store - -[ f ] [ foo store get-persistent ] unit-test - -USE: prettyprint -store get-global store-data . - -[ ] [ 100 foo store set-persistent ] unit-test - -[ ] [ save-the-store ] unit-test - -[ 100 ] [ foo store get-persistent ] unit-test - -delete-the-store -f store set-global diff --git a/extra/store/store.factor b/extra/store/store.factor deleted file mode 100644 index 46b1a09568..0000000000 --- a/extra/store/store.factor +++ /dev/null @@ -1,33 +0,0 @@ -! Copyright (C) 2006, 2007 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: assocs io io.files kernel namespaces serialize init ; -IN: store - -TUPLE: store path data ; - -C: store - -: save-store ( store -- ) - get-global dup store-data swap store-path - [ serialize ] with-stream ; - -: load-store ( path -- store ) - dup exists? [ - dup [ deserialize ] with-stream - ] [ - H{ } clone - ] if ; - -: define-store ( path id -- ) - over >r - [ >r resource-path load-store r> set-global ] 2curry - r> add-init-hook ; - -: get-persistent ( key store -- value ) - get-global store-data at ; - -: set-persistent ( value key store -- ) - [ get-global store-data set-at ] keep save-store ; - -: init-persistent ( value key store -- ) - 2dup get-persistent [ 3drop ] [ set-persistent ] if ; diff --git a/extra/webapps/pastebin/pastebin.factor b/extra/webapps/pastebin/pastebin.factor index 9492e9e5a1..5ac322a952 100755 --- a/extra/webapps/pastebin/pastebin.factor +++ b/extra/webapps/pastebin/pastebin.factor @@ -1,6 +1,6 @@ USING: calendar furnace furnace.validator io.files kernel -namespaces sequences store http.server.responders html -math.parser rss xml.writer xmode.code2html ; +namespaces sequences http.server.responders html math.parser rss +xml.writer xmode.code2html ; IN: webapps.pastebin TUPLE: pastebin pastes ; @@ -8,11 +8,7 @@ TUPLE: pastebin pastes ; : ( -- pastebin ) V{ } clone pastebin construct-boa ; -! Persistence -SYMBOL: store - -"pastebin.store" store define-store - pastebin store init-persistent + pastebin set-global TUPLE: paste summary author channel mode contents date @@ -25,11 +21,8 @@ TUPLE: annotation summary author mode contents ; C: annotation -: get-pastebin ( -- pastebin ) - pastebin store get-persistent ; - : get-paste ( n -- paste ) - get-pastebin pastebin-pastes nth ; + pastebin get pastebin-pastes nth ; : show-paste ( n -- ) serving-html @@ -49,7 +42,7 @@ C: annotation [ [ show-paste ] "show-paste-quot" set [ new-paste ] "new-paste-quot" set - get-pastebin "paste-list" render-component + pastebin get "paste-list" render-component ] with-html-stream ; \ paste-list { } define-action @@ -61,7 +54,7 @@ C: annotation over length min head ; : paste-feed ( -- entries ) - get-pastebin pastebin-pastes 20 safe-head [ + pastebin get pastebin-pastes 20 safe-head [ { paste-summary paste-link @@ -82,10 +75,8 @@ C: annotation pastebin-pastes 2dup length swap set-paste-n push ; : submit-paste ( summary author channel mode contents -- ) - [ - pastebin store get-persistent add-paste - store save-store - ] keep paste-link permanent-redirect ; + [ pastebin get add-paste ] keep + paste-link permanent-redirect ; \ new-paste \ submit-paste {