Permalink
Browse files

Added option to use high replication datastore localy

  • Loading branch information...
1 parent bd7d1f0 commit 3428bd2778d85e1d35c8881fa2e15c946592fed9 @FossiFoo FossiFoo committed Mar 14, 2012
Showing with 21 additions and 13 deletions.
  1. +8 −8 project.clj
  2. +6 −4 src/appengine_magic/core_local.clj
  3. +7 −1 src/appengine_magic/local_env_helpers.clj
View
@@ -1,4 +1,4 @@
-(defproject appengine-magic "0.4.7"
+(defproject appengine-magic "0.4.8"
:description "Google App Engine library for Clojure."
:min-lein-version "1.6.1"
:repositories {"releases" "http://appengine-magic-mvn.googlecode.com/svn/releases/"
@@ -18,12 +18,12 @@
[taglibs/standard "1.1.2"] ; repackaged-appengine-jakarta-standard-1.1.2.jar
[commons-el "1.0"]
;; main App Engine libraries
- [com.google.appengine/appengine-api-1.0-sdk "1.5.5"]
- [com.google.appengine/appengine-api-labs "1.5.5"]
- [com.google.appengine/appengine-api-stubs "1.5.5"]
- [com.google.appengine/appengine-local-runtime "1.5.5"]
- [com.google.appengine/appengine-local-runtime-shared "1.5.5"]
- [com.google.appengine/appengine-testing "1.5.5"]
- [com.google.appengine/appengine-tools-api "1.5.5"]]
+ [com.google.appengine/appengine-api-1.0-sdk "1.6.3.1"]
+ [com.google.appengine/appengine-api-labs "1.6.3.1"]
+ [com.google.appengine/appengine-api-stubs "1.6.3.1"]
+ [com.google.appengine/appengine-local-runtime "1.6.3.1"]
+ [com.google.appengine/appengine-local-runtime-shared "1.6.3.1"]
+ [com.google.appengine/appengine-testing "1.6.3.1"]
+ [com.google.appengine/appengine-tools-api "1.6.3.1"]]
:dev-dependencies [[org.clojure/clojure "1.2.1"]
[swank-clojure "1.4.0"]])
@@ -82,10 +82,11 @@
(defonce ^{:dynamic true} *server* (atom nil))
-(defn start [appengine-app & {:keys [port join?] :or {port 8080, join? false}}]
+(defn start [appengine-app & {:keys [port join? high-replication in-memory]
+ :or {port 8080, join? false, high-replication false, in-memory false}}]
(let [war-root (java.io.File. (:war-root appengine-app))
handler-servlet (servlet (:handler appengine-app))]
- (appengine-init war-root port)
+ (appengine-init war-root port high-replication in-memory)
(reset!
*server*
(jetty/start
@@ -135,6 +136,7 @@
(reset! *server* nil)))
-(defn serve [appengine-app & {:keys [port] :or {port 8080}}]
+(defn serve [appengine-app & {:keys [port high-replication in-memory]
+ :or {port 8080, high-replication false, in-memory false}}]
(stop)
- (start appengine-app :port port))
+ (start appengine-app :port port :high-replication high-replication :in-memory in-memory))
@@ -26,7 +26,7 @@
(getVersionId [] @*current-app-version*)))
-(defn appengine-init [#^File dir, port]
+(defn appengine-init [#^File dir, port high-replication in-memory]
(let [appengine-web-file (File. dir "WEB-INF/appengine-web.xml")
application-id (if (.exists appengine-web-file)
(first (xpath-value appengine-web-file "//application"))
@@ -47,6 +47,12 @@
(reset! *current-app-id* application-id)
(reset! *current-app-version* application-version)
(reset! *current-server-port* port)
+
+ ;; Set datastore properties for optional features
+ (.setProperty api-proxy "datastore.no_storage" (str in-memory))
+ (if high-replication
+ (.setProperty api-proxy "datastore.default_high_rep_job_policy_unapplied_job_pct" "20"))
+
(ApiProxy/setDelegate api-proxy)
;; This installs a thread environment onto the REPL thread and allows App
;; Engine API calls to work in the REPL.

0 comments on commit 3428bd2

Please sign in to comment.