Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

...
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
2  project.clj
View
@@ -1,4 +1,4 @@
-(defproject clojure-hbase "0.90.5-2"
+(defproject org.clojars.kurtharriger/clojure-hbase "0.90.5-2.1"
:description "A convenient Clojure interface to HBase."
:dependencies [[org.clojure/clojure "1.2.0"]
[org.apache.hadoop/hadoop-core "0.20.205.0"]
55 src/clojure_hbase/admin.clj
View
@@ -8,8 +8,11 @@
[org.apache.hadoop.hbase.util Bytes]
[org.apache.hadoop.hbase.io.hfile Compression]))
-(def ^{:tag HBaseAdmin :dynamic true :private true} *admin*
- (HBaseAdmin. (HBaseConfiguration/create)))
+(def ^{:tag HBaseAdmin :dynamic true} *admin*
+ (delay (HBaseAdmin. (HBaseConfiguration/create))))
+
+(defn get-admin []
+ (if (instance? clojure.lang.IDeref *admin*) @*admin* *admin*))
;;
;; HColumnDescriptor
@@ -72,7 +75,7 @@
(defn add-column-family
[table-name ^HColumnDescriptor column-descriptor]
- (.addColumn *admin* (to-bytes table-name) column-descriptor))
+ (.addColumn (get-admin) (to-bytes table-name) column-descriptor))
(defn hbase-available?
[]
@@ -80,93 +83,93 @@
(defn compact
[table-or-region-name]
- (.compact *admin* (to-bytes table-or-region-name)))
+ (.compact (get-admin) (to-bytes table-or-region-name)))
(defn create-table
[table-descriptor]
- (.createTable *admin* table-descriptor))
+ (.createTable (get-admin) table-descriptor))
(defn create-table-async
[^HTableDescriptor table-descriptor split-keys]
- (.createTableAsync *admin* table-descriptor split-keys))
+ (.createTableAsync (get-admin) table-descriptor split-keys))
(defn delete-column-family
[table-name column-name]
- (.deleteColumn *admin* (to-bytes table-name) (to-bytes column-name)))
+ (.deleteColumn (get-admin) (to-bytes table-name) (to-bytes column-name)))
(defn delete-table
[table-name]
- (.deleteTable *admin* (to-bytes table-name)))
+ (.deleteTable (get-admin) (to-bytes table-name)))
(defn disable-table
[table-name]
- (.disableTable *admin* (to-bytes table-name)))
+ (.disableTable (get-admin) (to-bytes table-name)))
(defn enable-table
[table-name]
- (.enableTable *admin* (to-bytes table-name)))
+ (.enableTable (get-admin) (to-bytes table-name)))
(defn flush
[table-or-region-name]
- (.flush *admin* (to-bytes table-or-region-name)))
+ (.flush (get-admin) (to-bytes table-or-region-name)))
(defn cluster-status
[]
- (.getClusterStatus *admin*))
+ (.getClusterStatus (get-admin)))
(defn get-connection
[]
- (.getConnection *admin*))
+ (.getConnection (get-admin)))
(defn get-master
[]
- (.getMaster *admin*))
+ (.getMaster (get-admin)))
(defn get-table-descriptor
[table-name]
- (.getTableDescriptor *admin* (to-bytes table-name)))
+ (.getTableDescriptor (get-admin) (to-bytes table-name)))
(defn master-running?
[]
- (.isMasterRunning *admin*))
+ (.isMasterRunning (get-admin)))
(defn table-available?
[table-name]
- (.isTableAvailable *admin* (to-bytes table-name)))
+ (.isTableAvailable (get-admin) (to-bytes table-name)))
(defn table-disabled?
[table-name]
- (.isTableDisabled *admin* (to-bytes table-name)))
+ (.isTableDisabled (get-admin) (to-bytes table-name)))
(defn table-enabled?
[table-name]
- (.isTableEnabled *admin* (to-bytes table-name)))
+ (.isTableEnabled (get-admin) (to-bytes table-name)))
(defn list-tables
[]
- (seq (.listTables *admin*)))
+ (seq (.listTables (get-admin))))
(defn major-compact
[table-or-region-name]
- (.majorCompact *admin* (to-bytes table-or-region-name)))
+ (.majorCompact (get-admin) (to-bytes table-or-region-name)))
(defn modify-column-family
[table-name column-name ^HColumnDescriptor column-descriptor]
- (.modifyColumn *admin* (to-bytes table-name) (to-bytes column-name)
+ (.modifyColumn (get-admin) (to-bytes table-name) (to-bytes column-name)
column-descriptor))
(defn modify-table
[table-name table-descriptor]
- (.modifyTable *admin* (to-bytes table-name) table-descriptor))
+ (.modifyTable (get-admin) (to-bytes table-name) table-descriptor))
(defn shutdown
[]
- (.shutdown *admin*))
+ (.shutdown (get-admin)))
(defn split
[table-or-region-name]
- (.split *admin* (to-bytes table-or-region-name)))
+ (.split (get-admin) (to-bytes table-or-region-name)))
(defn table-exists?
[table-name]
- (.tableExists *admin* (to-bytes table-name)))
+ (.tableExists (get-admin) (to-bytes table-name)))
4 src/clojure_hbase/core.clj
View
@@ -320,7 +320,7 @@
(second spec))
:columns (handle-get-columns get-op (second spec))
:family (.addFamily get-op (to-bytes (second spec)))
- :families (for [f (second spec)]
+ :families (doseq [f (second spec)]
(.addFamily get-op (to-bytes f)))
:filter (.setFilter get-op (second spec))
:all-versions (.setMaxVersions get-op)
@@ -568,7 +568,7 @@
(second spec))
:columns (handle-get-columns scan-op (second spec))
:family (.addFamily scan-op (to-bytes (second spec)))
- :families (for [f (second spec)]
+ :families (doseq [f (second spec)]
(.addFamily scan-op (to-bytes f)))
:filter (.setFilter scan-op (second spec))
:all-versions (.setMaxVersions scan-op)

No commit comments for this range

Something went wrong with that request. Please try again.