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)
(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
(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)
(get-env {:keys [ctx]})
Returns the environment map (not the ref)
Returns the environment map (not the ref)
(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
(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
(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
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close