Liking cljdoc? Tell your friends :D

riverford.durable-ref.core

Provides reference types that refer to clojure data potentially off-heap or remotely.

e.g (let [dref (dref/persist "file:///Users/foobar/objects" 42 {:as "edn"})] @dref ;; derefable (dref/reference (uri dref)) ;; reobtain the reference from a URI (dref/value (uri dref)) ;; alternative deref operator, takes a URI (and additional options) )

Reference identity is a URI, the scheme of which determines the type. e.g volatile: mutable, non-cached value: immutable, cached & interned while references exist.

The subscheme determines the storage implementation e.g file: File system storage mem: Transient memory storage

Further storages can be found in the scheme package. Extend to new schemes via the multimethods read-bytes write-bytes! and `delete-bytes!.

The file extension of the uri determines the storage format. e.g edn edn.zip

Further formats can be found inthe format package. Extend to new formats via the multimethods serialize and deserialize.

You can deref via value a URI, (or string uri), or a reference object obtained with reference.

Example URI's: volatile:mem://foo/bar/baz.edn value:file:///Users/foobar/objects/f79975f99908e5387fca3b503d9e9adbefaafc5e.edn.zip

Provides reference types that refer to clojure data potentially off-heap or remotely.

e.g
 (let [dref (dref/persist "file:///Users/foobar/objects" 42 {:as "edn"})]
   @dref ;; derefable
   (dref/reference (uri dref)) ;; reobtain the reference from a URI
   (dref/value (uri dref)) ;; alternative deref operator, takes a URI (and additional options)
  )

Reference identity is a URI, the scheme of which determines the type.
e.g
volatile: mutable, non-cached
value: immutable, cached & interned while references exist.

The subscheme determines the storage implementation
e.g
file: File system storage
mem: Transient memory storage

Further storages can be found in the `scheme` package.
Extend to new schemes via the multimethods `read-bytes` `write-bytes!` and `delete-bytes!.

The file extension of the uri determines the storage format.
e.g
edn
edn.zip

Further formats can be found inthe `format` package.
Extend to new formats via the multimethods `serialize` and `deserialize`.

You can deref via `value` a URI, (or string uri), or a reference object obtained with `reference`.

Example URI's:
`volatile:mem://foo/bar/baz.edn`
`value:file:///Users/foobar/objects/f79975f99908e5387fca3b503d9e9adbefaafc5e.edn.zip`
raw docstring

*verify-hash-identity*clj

source

atomic-swap!clj

(atomic-swap! dref f)
(atomic-swap! dref f opts)

Applies f to the value held by the ref atomically.

Applies `f` to the value held by the ref atomically.
sourceraw docstring

delete!clj

(delete! dref)
(delete! dref opts)

Deletes a reference from storage.

Accepts anything (apart from readonly refs) that can be referenced via reference.

Deletes a reference from storage.

Accepts anything (apart from readonly refs) that can be referenced via `reference`.
sourceraw docstring

delete-bytes!cljmultimethod

source

deserializecljmultimethod

source

do-atomic-swap!cljmultimethod

source

evict!clj

(evict! dref)

Forceably removes any cached value from the ref if present.

Forceably removes any cached value from the ref if present.
sourceraw docstring

existing-refclj

(existing-ref obj)

If an existing, realized reference can be be found in memory for an identical object, it will be returned.

If an existing, realized reference can be be found in memory for an identical object, it will be returned.
sourceraw docstring

get-deserializerclj

(get-deserializer uri)
source

get-serializerclj

(get-serializer uri)
source

IDurableCachedRefcljprotocol

-evict!clj

(-evict! this)
source

IDurableRefcljprotocol

-derefclj

(-deref this opts)

-propsclj

(-props this)
source

overwrite!clj

(overwrite! dref obj)
(overwrite! dref obj opts)

Writes the obj to the mutable ref.

Writes the obj to the mutable ref.
sourceraw docstring

persistclj

(persist base-uri obj)
(persist base-uri obj opts)

Persists the obj to a unique location (by value) under base-uri. Returns a DurableValueRef to the object.

The format of the returned ref will be determined by the :as option (edn by default).

Persists the obj to a unique location (by value) under `base-uri`.
Returns a DurableValueRef to the object.

The format of the returned ref will be determined by the `:as` option (edn by default).
sourceraw docstring

read-bytescljmultimethod

source

read-only?clj

(read-only? dref)
source

referenceclj

(reference uri)

Returns a ref for the URI according to the scheme. e.g value:mem:/foo/bar.

Returns a ref for the URI according to the scheme.
e.g value:mem:/foo/bar.
sourceraw docstring

serializecljmultimethod

source

uriclj

(uri dref)

Returns the URI of the ref.

Returns the URI of the ref.
sourceraw docstring

valueclj

(value dref)
(value dref opts)

Attempts to derefence a durable reference and returns a value. dref can be a anything accepted by reference.

May throw an error if in the case of a value ref, storage has been mutated. (override with the verify-hash-identity var), it may also throw in general if storage is unavailable or crashes for whatever reason.

Attempts to derefence a durable reference and returns a value.
dref can be a anything accepted by `reference`.

May throw an error if in the case of a value ref, storage has been mutated.
(override with the *verify-hash-identity* var), it may also throw in general if storage is unavailable or crashes for whatever reason.
sourceraw docstring

write-bytes!cljmultimethod

source

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

× close