Liking cljdoc? Tell your friends :D

eva.v2.datastructures.vector

Implementation of an append-only immutable vector in secondary storage. This implementation should behave correctly and safely under concurrent attempts to read and write. Writing to the end of the vector and reading from any position in the vector should be O(1). This data structure is intended to support the immutable write-ahead transaction log backing an Eva database.

Implementation of an append-only immutable vector in secondary storage.
This implementation should behave correctly and safely under concurrent
attempts to read and write. Writing to the end of the vector and reading from
any position in the vector should be O(1). This data structure is intended to
support the immutable write-ahead transaction log backing an Eva database.
raw docstring

chunked-mapclj

(chunked-map f batch-size coll)

Maps f over coll lazily in chunks of size batch-size

Maps f over coll lazily in chunks of size batch-size
sourceraw docstring

create-persisted-vectorclj

(create-persisted-vector value-store)
source

flipclj

(flip f x y)
source

init-headclj

(init-head)
source

lazy-read-rangeclj

(lazy-read-range v x y)
(lazy-read-range v x y batch-size read-ahead)

Realizes elements [x..y], exclusive on y, from the persisted vector lazily. Will realize in chunks of size batch-size' and asynchronously will attempt to stayread-ahead' chunks ahead of the last-read chunk

Realizes elements [x..y], exclusive on y, from the persisted vector
lazily.  Will realize in chunks of size `batch-size' and asynchronously
will attempt to stay `read-ahead' chunks ahead of the last-read chunk
sourceraw docstring

next-headclj

(next-head cur-head)
source

nth-keyclj

(nth-key head-key n)
source

open-persisted-vectorclj

(open-persisted-vector value-store head-key)
source

read-rangeclj

(read-range v x y)

Realizes elements [x..y], exclusive on y,from the persisted vector in batch

Realizes elements [x..y], exclusive on y,from the persisted vector in batch
sourceraw docstring

realize-chunkclj

(realize-chunk store vs)
source

repair-vector-headclj

(repair-vector-head pv store)

Given the current vector cons, it's possible for a new key / entry to be created but the cas process on the head fails afterwards, leaving the vector in an unusable state, where the head is one value behind the true length of the vector. This function will attempt to repair that state.

We do the following:

  1. Refresh the persisted vector to head state.

  2. Confirm that the key beyond the end of the head state does exist. --> someone has repaired in the meantime, warn that this happened, return the refreshed vector.

  3. Attempt to cas the head state manually. --> cas fails : throw an exception, concurrent attempts to repair.

  4. Return the rebuilt vector.

Given the current vector cons, it's possible for a new key / entry to be
created but the cas process on the head fails afterwards, leaving the
vector in an unusable state, where the head is one value behind the true
length of the vector. This function will attempt to repair that state.

We do the following:

1. Refresh the persisted vector to head state.

2. Confirm that the key beyond the end of the head state does exist.
   --> someone has repaired in the meantime, warn that this happened,
       return the refreshed vector.

3. Attempt to cas the head state manually.
   --> cas fails : throw an exception, concurrent attempts to repair.

4. Return the rebuilt vector.
sourceraw docstring

set-cur-head-valueclj

(set-cur-head-value pv head-value)
source

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

× close