Permalink
Browse files

Move all namespaces to flatland.* and artifact to org.flatland/masai.

  • Loading branch information...
1 parent f13f86e commit 01289c0c7423fe58a5240d665a508e31cd665ce5 @Raynes Raynes committed Oct 9, 2012
View
@@ -1,4 +1,4 @@
-(defproject masai "0.7.1"
+(defproject org.flatland/masai "0.7.1"
:url "https://github.com/flatland/masai"
:license {:name "Eclipse Public License - v 1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"}
@@ -1,4 +1,4 @@
-(ns masai.cursor
+(ns flatland.masai.cursor
(:refer-clojure :exclude [next key val]))
(defprotocol Cursor
@@ -1,5 +1,5 @@
-(ns masai.db
- (:require [masai.cursor :as c])
+(ns flatland.masai.db
+ (:require [flatland.masai.cursor :as c])
(:use [useful.macro :only [macro-do]]))
;; Instead of having separate, incompatible libraries to interface with
@@ -1,18 +1,18 @@
-(ns masai.memcached
+(ns flatland.masai.memcached
(:use [useful.map :only [into-map]])
- (:require masai.db)
+ (:require flatland.masai.db)
(:import net.spy.memcached.MemcachedClient
[java.net InetSocketAddress InetAddress]))
(defn key-format [^String s] (identity s))
(deftype DB [^MemcachedClient mdb endpoints]
- masai.db/EphemeralDB
+ flatland.masai.db/EphemeralDB
(add-expiry! [db key val exp] (.get (.add mdb (key-format key) exp val)))
(put-expiry! [db key val exp] (.get (.set mdb (key-format key) exp val)))
- masai.db/DB
+ flatland.masai.db/DB
(close [db]
(.shutdown mdb))
@@ -23,23 +23,23 @@
(fetch [db key]
(.get mdb (key-format key)))
- (add! [db key val] (masai.db/add-expiry! db key val 0))
- (put! [db key val] (masai.db/put-expiry! db key val 0))
+ (add! [db key val] (flatland.masai.db/add-expiry! db key val 0))
+ (put! [db key val] (flatland.masai.db/put-expiry! db key val 0))
(append! [db key val]
(let [fkey (key-format key)]
(if-let [appended (when-let [cas (.gets mdb key)]
(.get (.append mdb (.getCas cas) fkey val)))]
appended
- (masai.db/add! db key val))))
+ (flatland.masai.db/add! db key val))))
(len [db key]
- (if-let [record (masai.db/fetch db key)]
+ (if-let [record (flatland.masai.db/fetch db key)]
(count (str record))
-1))
(exists? [db key]
- (not= nil (masai.db/fetch db key)))
+ (not= nil (flatland.masai.db/fetch db key)))
(inc! [db key i]
(if (> 0 i)
@@ -1,7 +1,7 @@
-(ns masai.redis
+(ns flatland.masai.redis
(:use [useful.map :only [into-map]]
[clojure.stacktrace :only [root-cause]])
- (:require masai.db)
+ (:require flatland.masai.db)
(:import redis.clients.jedis.BinaryJedis))
(defn i-to-b
@@ -18,16 +18,16 @@
`(if (.isConnected ~db) ~@body))
(deftype DB [^BinaryJedis rdb opts key-format]
- masai.db/EphemeralDB
+ flatland.masai.db/EphemeralDB
(add-expiry! [db key val exp]
- (masai.db/add! db key val)
+ (flatland.masai.db/add! db key val)
(.expire rdb key exp))
(put-expiry! [db key val exp]
(.setex rdb key exp (bytes val)))
- masai.db/DB
+ flatland.masai.db/DB
(open [db]
(when-let [pass (:password opts)]
@@ -55,7 +55,7 @@
(len [db key]
(if-connected rdb
- (if-let [record (masai.db/fetch db key)]
+ (if-let [record (flatland.masai.db/fetch db key)]
(count record)
-1)
-1))
@@ -1,8 +1,8 @@
-(ns masai.tokyo
+(ns flatland.masai.tokyo
(:use [useful.map :only [into-map]]
[useful.utils :only [thread-local]])
- (:require masai.db retro.core
- [masai.tokyo-common :as tokyo])
+ (:require flatland.masai.db retro.core
+ [flatland.masai.tokyo-common :as tokyo])
(:import [tokyocabinet HDB]))
(def compress
@@ -58,7 +58,7 @@
(toString [this]
(pr-str this))
- masai.db/DB
+ flatland.masai.db/DB
(open [this]
(let [path (:path opts)]
(when-not (@open-paths path)
@@ -90,7 +90,7 @@
(len [this key]
(.vsiz hdb ^bytes (key-format key)))
(exists? [this key]
- (not (= -1 (masai.db/len this key))))
+ (not (= -1 (flatland.masai.db/len this key))))
(key-seq [this]
(.iterinit hdb)
(key-seq* hdb))
@@ -1,6 +1,6 @@
-(ns masai.tokyo-common
+(ns flatland.masai.tokyo-common
(:use [useful.utils :only [thread-local]])
- (:require [masai.db :as db]
+ (:require [flatland.masai.db :as db]
[retro.core :as retro]))
;; I hate this so much. But we need per-thread mutable state, without the safety of binding
@@ -1,9 +1,9 @@
-(ns masai.tokyo-sorted
+(ns flatland.masai.tokyo-sorted
(:use [useful.map :only [into-map]]
[useful.seq :only [lazy-loop]]
[useful.experimental :only [order-let-if]])
- (:require masai.db retro.core masai.cursor
- [masai.tokyo-common :as tokyo])
+ (:require flatland.masai.db retro.core flatland.masai.cursor
+ [flatland.masai.tokyo-common :as tokyo])
(:import [tokyocabinet BDB BDBCUR]))
(def compress
@@ -60,7 +60,7 @@
(def ^:private open-paths (atom #{}))
(defrecord DB [^BDB bdb opts key-format]
- masai.db/DB
+ flatland.masai.db/DB
(open [db]
(let [path (:path opts)]
(when-not (@open-paths path)
@@ -94,7 +94,7 @@
(len [db key]
(.vsiz bdb ^bytes (key-format key)))
(exists? [db key]
- (not (= -1 (masai.db/len db key))))
+ (not (= -1 (flatland.masai.db/len db key))))
(key-seq [db]
(.iterinit bdb)
(lazy-loop []
@@ -115,17 +115,17 @@
(truncate! [db]
(check (.vanish bdb)))
- masai.db/SequentialDB
+ flatland.masai.db/SequentialDB
(cursor [db key]
(-> (BDBCUR. bdb)
- (masai.cursor/jump (key-format key)))))
+ (flatland.masai.cursor/jump (key-format key)))))
(extend DB
retro.core/Transactional
(tokyo/transaction-impl DB bdb BDB))
(extend-type BDBCUR
- masai.cursor/Cursor
+ flatland.masai.cursor/Cursor
(next [this]
(when (.next this)
this))
@@ -148,7 +148,7 @@
(.jump this ^bytes k))
this))
- masai.cursor/MutableCursor
+ flatland.masai.cursor/MutableCursor
(put [this value]
(if (.put this ^bytes value BDBCUR/CPBEFORE)
this
@@ -1,12 +1,12 @@
-(ns masai.db-test
+(ns flatland.masai.db-test
(:refer-clojure :exclude [get count sync])
(:use clojure.test useful.debug)
- (:require [masai.tokyo :as tokyo]
- [masai.tokyo-sorted :as tokyo-btree]
- [masai.memcached :as memcached]
- [masai.redis :as redis]
- [masai.db :as db]
- [masai.cursor :as cursor]
+ (:require [flatland.masai.tokyo :as tokyo]
+ [flatland.masai.tokyo-sorted :as tokyo-btree]
+ [flatland.masai.memcached :as memcached]
+ [flatland.masai.redis :as redis]
+ [flatland.masai.db :as db]
+ [flatland.masai.cursor :as cursor]
[retro.core :as retro]))
(deftest tests

0 comments on commit 01289c0

Please sign in to comment.