Liking cljdoc? Tell your friends :D

tech.queue.resource-limit

It is not uncommon for a machine that is running heterogeneous tasks to have different tasks take vastly different amounts of resources. Some may use a lot of ram but no cpu, etc. Resource limit is a generic way to limit the amount of resources the system can use assuming they can be statically defined for the task.

In our case resources are represented by an integer and as long as subtracting that number from the system's resources returns a result above or equal to zero we assume that those resources are available.

A resource map can contain many entries of keyword->integer.

At manager creation time a similar map is provided indicating the initial state.

It is not uncommon for a machine that is running heterogeneous tasks
to have different tasks take vastly different amounts of resources.
Some may use a lot of ram but no cpu, etc.
Resource limit is a generic way to limit the amount of resources the
system can use assuming they can be statically defined for the task.

In our case resources are represented by an integer and as long as
subtracting that number from the system's resources returns a result
above or equal to zero we assume that those resources are available.

A resource map can contain many entries of keyword->integer.

At manager creation time a similar map is provided indicating the initial state.
raw docstring

default-resource-mapclj

(default-resource-map &
                      {:keys [unavailable-system-mem]
                       :or {unavailable-system-mem (gigabyte->megabyte 1)}})
source

gigabyte->megabyteclj

(gigabyte->megabyte gig)
source

jvm-resourcesclj

(jvm-resources)
source

megabyte->byteclj

(megabyte->byte meg)
source

PResourceManagercljprotocol

release-resources!clj

(release-resources! mgr resource-map)

nonblocking returns resources to the source

nonblocking returns resources to the source

request-resources!clj

(request-resources! mgr resource-map timeout-ms)

potentially blocking call, returns when resources can be satisfied

potentially blocking call, returns when resources can be satisfied
source

resource-managerclj

(resource-manager {:keys [initial-resources]
                   :or {initial-resources (default-resource-map)}})
source

system-resourcesclj

(system-resources)
source

with-resourcescljmacro

(with-resources mgr resource-map timeout & body)
source

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

× close