Liking cljdoc? Tell your friends :D

fileape.core

entry point namespace, for usage see https://github.com/gerritjvv/fileape

(require '[fileape.core :refer :all]) (import '[java.io File DataOutputStream]) (defn callback-f [{:keys [file]}] (prn "File rolled " file)) (def ape2 (ape {:codec :gzip :base-dir "testdir" :check-freq 5000 :rollover-size 134217728 :rollover-timeout 60000 :roll-callbacks [callback-f]})) (write ape2 "abc-123" (fn [{:keys [^DataOutputStream out]}] (.writeInt out (int 1)))) (close ape2)

entry point namespace, for usage see https://github.com/gerritjvv/fileape

(require '[fileape.core :refer :all])
(import '[java.io File DataOutputStream])
(defn callback-f [{:keys [file]}]
   (prn "File rolled " file))
   (def ape2 (ape {:codec :gzip
                   :base-dir "testdir"
                   :check-freq 5000
                   :rollover-size 134217728
                   :rollover-timeout 60000
                   :roll-callbacks [callback-f]}))
                   (write ape2 "abc-123" (fn [{:keys [^DataOutputStream out]}]
                                               (.writeInt out (int 1))))
    (close ape2)
raw docstring

apeclj

(ape {:keys [codec base-dir rollover-size rollover-timeout rollover-abs-timeout
             check-freq roll-callbacks error-handler out-buffer-size use-buffer
             parallel-files retries retry-sleep env]
      :or {retry-sleep 500
           out-buffer-size 32768
           check-freq 10000
           retries 3
           use-buffer true
           rollover-timeout 60000
           rollover-abs-timeout Long/MAX_VALUE
           rollover-size 134217728
           codec :gzip
           parallel-files 2}
      :as ape-conf})

Entrypoint to the api, creates the resources for writing roll-callbacks - on each file roll all functions in this list are called, they are called with a map of keys [file codec file-key future-file-name ^AtomicLong record-count ^AtomicReference(long) updated] error-handler a function that is called if any errors happen in the writer agents as (error-handler error fn) Returns a map with a key :env that can be updated using update-env!, and is used depending on the storage plugins

Retries: operations in the root agent i.e create-file and resources are retried (default 3) with a retry-sleep between each retry (default 500ms) it is done so that if file resources are scarce we try our best to wait then retry etc, if we run out of retries the error-handler is called Retries do block the root agent and thus all sending

Entrypoint to the api, creates the resources for writing
roll-callbacks - on each file roll all functions in this list are called, they are called with a map of keys [file codec file-key future-file-name ^AtomicLong record-count ^AtomicReference(long) updated]
error-handler a function that is called if any errors happen in the writer agents as (error-handler error fn)
Returns a map with a key :env that can be updated using update-env!, and is used depending on the storage plugins

Retries: operations in the root agent i.e create-file and resources are retried (default 3) with a retry-sleep between each retry (default 500ms)
         it is done so that if file resources are scarce we try our best to wait then retry etc, if we run out of retries the error-handler is called
         Retries do block the root agent and thus all sending
sourceraw docstring

ape-new-ctxclj

(ape-new-ctx {:keys [ctx] :as ape-ctx} k v)

Create a new ape ctx with the k v applied to the config, usage: (ape-new-ctx ape :codec :lzo)

Create a new ape ctx with the k v applied to the config,
usage: (ape-new-ctx ape :codec :lzo)
sourceraw docstring

closeclj

(close ape)
source

create-future-file-nameclj

(create-future-file-name f)
source

get-base-dirclj

(get-base-dir {:keys [ctx]})
source

get-codecclj

(get-codec {:keys [ctx]})
source

get-envclj

(get-env {:keys [ctx]})

Returns the environment map (not the ref)

Returns the environment map (not the ref)
sourceraw docstring

roll-over-checkclj

(roll-over-check conf {:keys [k file updated]})
source

th-rand-intclj

(th-rand-int n)

Returns a random number using the ThreadLocalRandom class from java 1.7

Returns a random number using the ThreadLocalRandom class from java 1.7
sourceraw docstring

update-env!clj

(update-env! {{:keys [env conf]} :ctx} k & args)

Update the :env variable for a ape context. Calls alter env f args, This is used to support any dynamic env plugin storage,

Note that this env should be keyed on the same keys given to write

Update the :env variable for a ape context.
Calls alter env f args,
This is used to support any dynamic env plugin storage,

Note that this env should be keyed on the same keys given to write
sourceraw docstring

writeclj

(write ape k f)
source

write-timeoutclj

(write-timeout ape k f timeout)

Write with timeout support, if the timeout is reached before a write can start a TimeoutException is thrown

Write with timeout support, if the timeout is reached before a write can start a TimeoutException is thrown
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close