Implementation of stack based resource system. Simple, predictable, deterministic, and applicable to most problems. Resource contexts are sequences of resources that need to be, at some point, released.
Implementation of stack based resource system. Simple, predictable, deterministic, and applicable to most problems. Resource contexts are sequences of resources that need to be, at some point, released.
(ignore item)
Ignore specifically this resource.
Ignore specifically this resource.
(ignore-resources pred)
Ignore these resources for which pred returns true and do not track them. They will not be released unless added again with track
Ignore these resources for which pred returns true and do not track them. They will not be released unless added again with track
(release item)
Release this resource and remove it from tracking. Exceptions propagate to callers.
Release this resource and remove it from tracking. Exceptions propagate to callers.
(release-current-resources)
(release-current-resources pred)
Release all resources matching either a predicate or all resources currently tracked. Returns any exceptions that happened during release but continues to attempt to release anything else in the resource list.
Release all resources matching either a predicate or all resources currently tracked. Returns any exceptions that happened during release but continues to attempt to release anything else in the resource list.
(release-resource-seq res-ctx & {:keys [pred]})
Release a resource context returned from return-resource-context.
Release a resource context returned from return-resource-context.
(return-resource-seq & body)
Run code and return both the return value and the resources the code created. Returns: {:return-value retval :resource-seq resources}
Run code and return both the return value and the resources the code created. Returns: {:return-value retval :resource-seq resources}
(track item)
(track item dispose-fn)
Begin tracking this resource. Resource be released when current resource context ends. If the item satisfies the PResource protocol, then it can be tracked itself. Else the dispose function is tracked.
Begin tracking this resource. Resource be released when current resource context ends. If the item satisfies the PResource protocol, then it can be tracked itself. Else the dispose function is tracked.
(with-bound-resource-seq resource-seq & body)
Run code and return both the return value and the (updated,appended) resources created. Returns: {:return-value retval :resource-seq resources}
Run code and return both the return value and the (updated,appended) resources created. Returns: {:return-value retval :resource-seq resources}
(with-resource-context & body)
Begin a new resource context. Any resources added while this context is open will be released when the context ends.
Begin a new resource context. Any resources added while this context is open will be released when the context ends.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close