Liking cljdoc? Tell your friends :D

riemann.service

Lifecycle protocol for stateful services bound to a core.

Lifecycle protocol for stateful services bound to a core.
raw docstring

all-equal?cljmacro

(all-equal? a b & forms)

Takes two objects to compare and a list of forms to compare them by.

(all-equiv? foo bar
  (class)
  (foo 2)
  (.getSize))

becomes

(let [a foo
      b bar]
  (and (= (class a) (class b))
       (= (foo 2 a) (foo 2 b))
       (= (.getSize a) (.getSize b))))
Takes two objects to compare and a list of forms to compare them by.

```clojure
(all-equiv? foo bar
  (class)
  (foo 2)
  (.getSize))
```

becomes

```clojure
(let [a foo
      b bar]
  (and (= (class a) (class b))
       (= (foo 2 a) (foo 2 b))
       (= (.getSize a) (.getSize b))))
```
sourceraw docstring

executor-serviceclj

(executor-service name f)
(executor-service name equiv-key f)

Creates a new threadpool executor service ... service! Takes a function which generates an ExecutorService. Returns an ExecutorServiceService which provides start/stop/reload/equiv? lifecycle management of that service.

Equivalence-key controls how services are compared to tell if they are equivalent. Services with a nil equivalence key are never equivalent. Otherwise, services are equivalent when their class, name, and equiv-key are equal.

(executor-service* :graphite {foo: 4}
  #(ThreadPoolExecutor. 2 ...))
Creates a new threadpool executor service ... service! Takes a function
which generates an ExecutorService. Returns an ExecutorServiceService which
provides start/stop/reload/equiv? lifecycle management of that service.

Equivalence-key controls how services are compared to tell if they are
equivalent. Services with a nil equivalence key are *never* equivalent.
Otherwise, services are equivalent when their class, name, and equiv-key are
equal.

```clojure
(executor-service* :graphite {foo: 4}
  #(ThreadPoolExecutor. 2 ...))
```
sourceraw docstring

IExecutorServiceServicecljprotocol

getExecutorclj

(getExecutor this)
source

literal-executor-servicecljmacro

(literal-executor-service name executor-service-expr)

Like executor-service, but captures the expression passed to it as the equivalence key. This only works if the expression is literal; if there are any variables or function calls, they will be compared as code, not as their evaluated values.

  • OK: (literal-executor-service :io (ThreadPoolExecutor. 2 ...))
  • OK: (literal-executor-service :io (ThreadPoolExecutor. (inc 1) ...))
  • BAD: (literal-executor-service :io (ThreadPoolExecutor. x ...))
Like executor-service, but captures the *expression* passed to it as the
equivalence key. This only works if the expression is literal; if there are
any variables or function calls, they will be compared as code, not as
their evaluated values.

- OK:  (literal-executor-service :io (ThreadPoolExecutor. 2 ...))
- OK:  (literal-executor-service :io (ThreadPoolExecutor. (inc 1) ...))
- BAD: (literal-executor-service :io (ThreadPoolExecutor. x ...))
sourceraw docstring

scheduled-task-serviceclj

(scheduled-task-service name equiv-key interval delay f)

Returns a ScheduledTaskService which will schedule a task which call (f core) repeatedly every interval after delay seconds. Equivalent to other ScheduledTaskService with the same name, equiv-key, delay and interval. Conflicts with other ScheduledTaskService of the same name.

Returns a ScheduledTaskService which will schedule a task which call (f core)
repeatedly every `interval` after `delay` seconds.
Equivalent to other ScheduledTaskService with the same `name`, `equiv-key`,
`delay` and `interval`.
Conflicts with other ScheduledTaskService of the same name.
sourceraw docstring

Servicecljprotocol

Services are components of a core with a managed lifecycle. They're used for stateful things like connection pools, network servers, and background threads.

Services are components of a core with a managed lifecycle. They're used for
stateful things like connection pools, network servers, and background
threads.

conflict?clj

(conflict? service1 service2)

Do these two services conflict with one another? Adding a service to a core replaces any conflicting services.

Do these two services conflict with one another? Adding
a service to a core *replaces* any conflicting services.

reload!clj

(reload! service core)

Informs the service of a change in core.

Informs the service of a change in core.

start!clj

(start! service)

Starts a service. Must be idempotent.

Starts a service. Must be idempotent.

stop!clj

(stop! service)

Stops a service. Must be idempotent.

Stops a service. Must be idempotent.
sourceraw docstring

ServiceEquivcljprotocol

equiv?clj

(equiv? service1 service2)

Used to identify which services can remain running through a core transition, like reloading. If the old service is equivalent to the new service, the old service may be preserved and used by the new core. Otherwise, the old service may be shut down and replaced by the new.

Used to identify which services can remain running through a core
transition, like reloading. If the old service is equivalent to the
new service, the old service may be preserved and used by the new
core. Otherwise, the old service may be shut down and replaced by
the new.
source

ServiceStatuscljprotocol

running?clj

(running? service)

Queries the running state of the service.

Queries the running state of the service.
source

thread-serviceclj

(thread-service name f)
(thread-service name equiv-key f)

Returns a ThreadService which will call (f core) repeatedly when started. Will only stop between calls to f. Start and stop are blocking operations. Equivalent to other ThreadServices with the same name and equivalence key-- if not provided, defaults nil. Conflicts with other ThreadServices of the same name.

Returns a ThreadService which will call (f core) repeatedly when started.
Will only stop between calls to f. Start and stop are blocking operations.
Equivalent to other ThreadServices with the same name and equivalence key--
if not provided, defaults nil. Conflicts with other ThreadServices of the
same name.
sourceraw docstring

threadpool-serviceclj

(threadpool-service name)
(threadpool-service name
                    {:keys [core-pool-size max-pool-size keep-alive-time
                            keep-alive-unit queue-size]
                     :as opts
                     :or {core-pool-size 1
                          max-pool-size 128
                          keep-alive-time 10
                          keep-alive-unit TimeUnit/MILLISECONDS
                          queue-size 1000}})

An ExecutorServiceService based on a ThreadPoolExecutor with core and maximum threadpool sizes, and a LinkedBlockingQueue of a given size. Options:

  • :core-pool-size Default 1
  • :max-pool-size Default 128
  • :keep-alive-time Default 10
  • :keep-alive-unit Default MILLISECONDS
  • :queue-size Default 1000
An ExecutorServiceService based on a ThreadPoolExecutor with core and
maximum threadpool sizes, and a LinkedBlockingQueue of a given size. Options:

- :core-pool-size             Default 1
- :max-pool-size              Default 128
- :keep-alive-time            Default 10
- :keep-alive-unit            Default MILLISECONDS
- :queue-size                 Default 1000
sourceraw docstring

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

× close