hbase-clj.core

->HBTable-schema

(->HBTable-schema hb table-name id-type families)
Positional factory function for class hbase_clj.core.HBTable-schema.

def-hbtable

macro

(def-hbtable table {:keys [id-type table-name hbase], :or {id-type :string}} & families)
defines a htable "schema", 
types could be one of #{:int :long :string :keyword :raw}
and could create custom types via codec.defcodec
families could be like: 

--------------Snippet--------------
...
....
:info {:--ktype :keyword
       :--vtype :string 
       :age :long}

:following {:--ktype :string
            :--vtype :string}
....
...
-----------------------------------

where `--ktype` means the type of all keys in the family, default as `:keyword`
`--vtype` means the default type of values in the family, default as `string`
and other k-v stands for a specified value type given a key, instead of the `--vtype`

defhbase

macro

(defhbase name & options)
Defines a HBase Connection config with specified var name according to the options, 
params should be pairs, e.g: 
(defhbase main-hb
  "hbase.zookeeper.quorum" "localhost"
  ...
  ...)

gen-hbase

gen-htable

(gen-htable table-name {:keys [id-type hbase]} & families)

get

(get & rows)
Get from HBase Table according to specified ids
Should only be called inside `with-table`
--------------------
usage:
(get id|attrs id|attrs ....)
(get :with-versions ...)

id|attrs could be id or a pair like vec: [id attrs]
which attrs should be a hash-map of {family-> col/cols}
col/cols could either be a col, a vector of cols or :* which stands for all cols

e.g: 
--------------------
(get "001" 
     ["002" {:info :*}]
     ["003" {:info [:age :name] :follow :*}]
    ....)
--------------------

Returns a seq of vec: [id, record]
where every record as: {family-> {col-> val}}
if passed `:with-versions` as the first arg, val would be a coll of {:val xxx :timestamp xxx}

incr!

(incr! & rows)
Make atomic incrementations on certain row-family-col-s inside an HBase Table
Should only be called inside `with-table`
--------------------
usage: 
(incr! [id, attrs] [id, attrs] ....)
attrs should be a hash-map of {family-> {col-> val}}

map->HBTable-schema

(map->HBTable-schema m__6522__auto__)
Factory function for class hbase_clj.core.HBTable-schema, taking a map of keywords to field values.

put!

(put! & records)
Put into HBase Table
Should only be called inside `with-table`
--------------------
usage: 
(put! [id, attrs] [id, attrs] ....)
attrs should be a hashmap of {family-> {col-> val}}

scan

(scan & args)
Scan inside HBase Table according to certain rules
Should only be called inside `with-table`
--------------------
usage:
(scan & options)
(scan :with-versions & options)
options could contain these keys:
  - :eager?       If set to true, return a vector similar to the result of `get`, if false, returns a lazy seq to fetch results later.
  - :start-id     The ID the htable-scan starts from (including)
  - :stop-id      The ID the htable-scan stops at (non-including)
  - :cache-size   The number of rows fetched when getting a "next" item, only takes effect when `eager?` is set to false
  - :small?       Determine if this is a "small" scan, see: https://hbase.apache.org/0.94/apidocs/org/apache/hadoop/hbase/client/Scan.html#setSmall(boolean)
  - :max-versions The max version to fetch on each record
  - :time-range   The time-range to fetch on each record
  - :attrs        Same as the definition of `<attrs>` in `(get ..)`

with-table

macro

(with-table table & form)
Performs all operations inside the specified table and the close the table
`table` should be an HBTable-schema generated by `def-hbtable`