Liking cljdoc? Tell your friends :D

views.core


->view-sigclj

(->view-sig view-id parameters)
(->view-sig namespace view-id parameters)
source

add-views!clj

(add-views! view-system views)

Add a collection of views to the system.

Add a collection of views to the system.
sourceraw docstring

assoc-hashclj

(assoc-hash view-system view-sig data-hash)

Set the hash for a view-sig to the given value.

Set the hash for a view-sig to the given value.
sourceraw docstring

assoc-hash-if-missing!clj

(assoc-hash-if-missing! view-system view-sig data-hash)

Add a hash if it is missing.

Add a hash if it is missing.
sourceraw docstring

can-refresh?clj

(can-refresh? last-update min-refresh-interval)
source

default-optionsclj

Default options used to initialize the views system via init!

:send-fn (fn [subscriber-key [view-sig view-data]] ...) REQUIRED A function that is used to send view refresh data to subscribers. This function must be set for normal operation of the views system.

:put-hints-fn (fn [^Atom view-system hints] (refresh-views! view-system hints)) REQUIRED A function that adds hints to the view system. this function will be used by other libraries that implement IView. This function must be set for normal operation of the views system. The default function provided will trigger relevant view refreshes immediately.

:refresh-queue-size 1000 REQUIRED The size of the queue used to hold view refresh requests for the worker threads. For very heavy systems, this can be set higher if you start to get warnings about dropped refresh requests.

:refresh-interval 1000 REQUIRED Interval in milliseconds at which the refresh watcher thread will check for any queued up hints and dispatch relevant view refresh updates to the worker threads.

:worker-threads 8 REQUIRED The number of refresh worker threads that poll for view refresh requests and dispatch updated view data to subscribers.

:views nil A list of IView instances. these are the views that can be subscribed to. views can also be added/replaced after system initialization through the use of add-views!

:auth-fn (fn [view-sig subscriber-key context] ... ) A function that authorizes view subscriptions. should return true if the subscription is authorized. If not set, no view subscriptions will require any authorization.

:on-unauth-fn (fn [view-sig subscriber-key context] ... ) A function that is called when subscription authorization fails.

:namespace-fn (fn [view-sig subscriber-key context] ... ) A function that returns a namespace to use for view subscriptions.

:stats-log-interval nil Interval in milliseconds at which a logger will write view system statistics to the log. if not set, the logger will be disabled.

Default options used to initialize the views system via init!

:send-fn (fn [subscriber-key [view-sig view-data]] ...)
*REQUIRED*
A function that is used to send view refresh data to subscribers.
This function must be set for normal operation of the views system.

:put-hints-fn       (fn [^Atom view-system hints] (refresh-views! view-system hints))
*REQUIRED*
A function that adds hints to the view system. this function will be used
by other libraries that implement IView. This function must be set for
normal operation of the views system. The default function provided
will trigger relevant view refreshes immediately.

:refresh-queue-size 1000
*REQUIRED*
The size of the queue used to hold view refresh requests for
the worker threads. For very heavy systems, this can be set
higher if you start to get warnings about dropped refresh requests.

:refresh-interval   1000
*REQUIRED*
Interval in milliseconds at which the refresh watcher thread will
check for any queued up hints and dispatch relevant view refresh
updates to the worker threads.

:worker-threads     8
*REQUIRED*
The number of refresh worker threads that poll for view refresh
requests and dispatch updated view data to subscribers.

:views              nil
A list of IView instances. these are the views that can be subscribed
to. views can also be added/replaced after system initialization through
the use of add-views!

:auth-fn            (fn [view-sig subscriber-key context] ... )
A function that authorizes view subscriptions. should return true if the
subscription is authorized. If not set, no view subscriptions will require
any authorization.

:on-unauth-fn       (fn [view-sig subscriber-key context] ... )
A function that is called when subscription authorization fails.

:namespace-fn       (fn [view-sig subscriber-key context] ... )
A function that returns a namespace to use for view subscriptions.

:stats-log-interval nil
Interval in milliseconds at which a logger will write view system
statistics to the log. if not set, the logger will be disabled.
sourceraw docstring

do-view-refresh!clj

(do-view-refresh! view-system
                  {:keys [namespace view-id parameters] :as view-sig})
source

hintclj

(hint namespace hint type)

Create a hint.

Create a hint.
sourceraw docstring

init!clj

(init! options)
(init! view-system options)

Initializes the view system for use with the list of views provided.

An existing atom that will be used to store the state of the views system can be provided, otherwise one will be created. Either way, the atom with the initialized view system is returned.

Options is a map of options to configure the view system with. See views.core/default-options for a description of the available options and the defaults that will be used for any options not provided in the call to init!.

Initializes the view system for use with the list of views provided.

An existing atom that will be used to store the state of the views
system can be provided, otherwise one will be created. Either way,
the atom with the initialized view system is returned.

Options is a map of options to configure the view system with. See
views.core/default-options for a description of the available options
and the defaults that will be used for any options not provided in
the call to init!.
sourceraw docstring

poll-queue!clj

(poll-queue! view-system)

Poll the view system refresh queue returning next refresh. This blocks for 60 seconds.

Poll the view system refresh queue returning next refresh. This blocks for 60 seconds.
sourceraw docstring

pop-hints!clj

(pop-hints! view-system)

Return hints and clear hint set atomicly.

Return hints and clear hint set atomicly.
sourceraw docstring

put-hints!clj

(put-hints! view-system hints)

Adds a collection of hints to the view system by using the view system configuration's :put-hints-fn.

Adds a collection of hints to the view system by using the view system
configuration's :put-hints-fn.
sourceraw docstring

queue-hints!clj

(queue-hints! view-system hints)

Queues up hints in the view system so that they will be picked up by the refresh watcher and dispatched to the workers resulting in view updates being sent out for the relevant views/subscribers.

Queues up hints in the view system so that they will be picked up by the refresh
watcher and dispatched to the workers resulting in view updates being sent out
for the relevant views/subscribers.
sourceraw docstring

refresh-view!clj

(refresh-view! view-system
               hints
               {:keys [namespace view-id parameters] :as view-sig})

Schedules a view (identified by view-sig) to be refreshed by one of the worker threads only if the provided collection of hints is relevant to that view.

Schedules a view (identified by view-sig) to be refreshed by one of the worker threads
only if the provided collection of hints is relevant to that view.
sourceraw docstring

refresh-views!clj

(refresh-views! view-system)
(refresh-views! view-system hints)

Given a collection of hints, or a single hint, find all dirty views and schedule them for a refresh.

Given a collection of hints, or a single hint, find all dirty views and schedule them for a refresh.
sourceraw docstring

shutdown!clj

(shutdown! view-system & [dont-wait-for-threads?])

Shuts the view system down, terminating all worker threads and clearing all view subscriptions and data.

Shuts the view system down, terminating all worker threads and clearing
all view subscriptions and data.
sourceraw docstring

start-update-watcher!clj

(start-update-watcher! view-system min-refresh-interval threads)

Starts threads for the views refresh watcher and worker threads that handle queued hints and view refresh requests.

Starts threads for the views refresh watcher and worker threads that handle queued
hints and view refresh requests.
sourceraw docstring

stop-update-watcher!clj

(stop-update-watcher! view-system & [dont-wait-for-threads?])

Stops threads for the views refresh watcher and worker threads.

Stops threads for the views refresh watcher and worker threads.
sourceraw docstring

subscribe!clj

(subscribe! view-system
            {:keys [view-id parameters] :as view-sig}
            subscriber-key
            context)

Creates a subscription to a view identified by view-sig for a subscriber identified by subscriber-key. If the subscription is not authorized, returns nil. Additional context info can be passed in, which will be passed to the view-system's namespace-fn and auth-fn (if provided). If the subscription is successful, the subscriber will be sent the initial data for the view.

Creates a subscription to a view identified by view-sig for a subscriber
identified by subscriber-key. If the subscription is not authorized,
returns nil. Additional context info can be passed in, which will be
passed to the view-system's namespace-fn and auth-fn (if provided). If
the subscription is successful, the subscriber will be sent the initial
data for the view.
sourceraw docstring

subscribe-viewclj

(subscribe-view view-system view-sig subscriber-key)
source

subscribed-viewsclj

(subscribed-views view-system)

Returns a list of all views in the system that have subscribers.

Returns a list of all views in the system that have subscribers.
sourceraw docstring

unsubscribe!clj

(unsubscribe! view-system
              {:keys [view-id parameters] :as view-sig}
              subscriber-key
              context)

Removes a subscription to a view identified by view-sig for a subscriber identified by subscriber-key. Additional context info can be passed in, which will be passed to the view-system's namespace-fn (if provided).

Removes a subscription to a view identified by view-sig for a subscriber
identified by subscriber-key. Additional context info can be passed in,
which will be passed to the view-system's namespace-fn (if provided).
sourceraw docstring

unsubscribe-all!clj

(unsubscribe-all! view-system subscriber-key)

Remove all subscriptions by a given subscriber.

Remove all subscriptions by a given subscriber.
sourceraw docstring

view-systemclj

(view-system options)

Return a new view system.

Return a new view system.
sourceraw docstring

waitclj

(wait last-update min-refresh-interval)
source

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

× close