Liking cljdoc? Tell your friends :D

hyperfiddle.electric.impl.mount-point

A mount-point instance maintains :

  • a hash map storing items indexed by tag. An item is a mutable object tracking the lifecycle of each entry in the resulting incseq.
  • a set of active readers. Each mutation of the store sends an invalidation event for the item being touched to the readers currently active.

A reader process maintains :

  • a call tree isomorphic to the subset of the application's call tree restricted to the ancestors of active items. Leaves are items, nodes are either blocks or calls, block children are items or calls, call children are blocks, the root is a call.
  • a hash map storing blocks indexed by frame. A block is a mutable object tracking each known frame. A frame is known when either it's an ancestor of an active item, or it's currently being mounted by a call that is in the common ancestry of an active item.
  • a mailbox for step events on calls and another one for invalidation events on items. Both mailboxes are consumed during reader process transfer, call events take priority over the item events but ordering of events within a single mailbox is irrelevant. The processing of each event mutates the call tree and generates a diff, then the concatenation of successive diffs is returned. When the reader is spawned, an invalidation event is posted for each active item.

On item invalidation event :

  • If the item is inactive :
    • If it was attached in the call tree, it is detached from the tree and a shrink is generated if the item was mounted.
    • If it was detached from the call tree, nothing happens.
  • If the item is active :
    • If it was attached in the call tree, a change is generated if the item was mounted.
    • If it was detached from the call tree, it is attached to the tree and a grow is generated if the item was mounted.

On call step event :

  1. Apply permutation. The call permutation must be expanded to take into account the offset and length of the call segment in the current sequence state.
  2. Apply changes. For each item change that is not a grow, the block associated to previous frame is unmounted. The new frame is then associated to its block and mounted.
  3. Apply shrinks. The blocks associated with removed frames are unmounted.

Unmounting a block generates a shrink for each active item having this block's frame as an ancestor. Mounting a block generates a grow for each active item having this block's frame as an ancestor.

A mount-point instance maintains :
* a hash map storing items indexed by tag. An item is a mutable object tracking the lifecycle of each entry in the
  resulting incseq.
* a set of active readers. Each mutation of the store sends an invalidation event for the item being touched to the
  readers currently active.

A reader process maintains :
* a call tree isomorphic to the subset of the application's call tree restricted to the ancestors of active items.
  Leaves are items, nodes are either blocks or calls, block children are items or calls, call children are blocks, the
  root is a call.
* a hash map storing blocks indexed by frame. A block is a mutable object tracking each known frame. A frame is known
  when either it's an ancestor of an active item, or it's currently being mounted by a call that is in the common
  ancestry of an active item.
* a mailbox for step events on calls and another one for invalidation events on items. Both mailboxes are consumed
  during reader process transfer, call events take priority over the item events but ordering of events within a single
  mailbox is irrelevant. The processing of each event mutates the call tree and generates a diff, then the concatenation
  of successive diffs is returned. When the reader is spawned, an invalidation event is posted for each active item.

On item invalidation event :
* If the item is inactive :
  * If it was attached in the call tree, it is detached from the tree and a shrink is generated if the item was mounted.
  * If it was detached from the call tree, nothing happens.
* If the item is active :
  * If it was attached in the call tree, a change is generated if the item was mounted.
  * If it was detached from the call tree, it is attached to the tree and a grow is generated if the item was mounted.

On call step event :
1. Apply permutation. The call permutation must be expanded to take into account the offset and length of the call
   segment in the current sequence state.
2. Apply changes. For each item change that is not a grow, the block associated to previous frame is unmounted. The new
   frame is then associated to its block and mounted.
3. Apply shrinks. The blocks associated with removed frames are unmounted.

Unmounting a block generates a shrink for each active item having this block's frame as an ancestor.
Mounting a block generates a grow for each active item having this block's frame as an ancestor.
raw docstring

apply-changeclj

(apply-change call change diff)
source

apply-permutationclj

(apply-permutation call permutation diff)
source

apply-shrinkclj

(apply-shrink call degree shrink diff)
source

block-attach-to-callclj

(block-attach-to-call block)
source

block-attach-to-treeclj

(block-attach-to-tree block reader diff)
source

block-childclj

(block-child block id)
source

block-empty?clj

(block-empty? block)
source

block-indexclj

(block-index call id)
source

block-mountclj

(block-mount block offset diff)
source

block-releaseclj

(block-release block)
source

block-set-childclj

(block-set-child block id child)
source

block-single-childclj

(block-single-child block)
source

block-slot-childrenclj

source

block-slot-frameclj

source

block-slot-indexclj

source

block-slot-nextclj

source

block-slot-parentclj

source

block-slot-prevclj

source

block-slot-weightsclj

source

block-slotsclj

source

block-unmountclj

(block-unmount block diff)
source

block-weightclj

(block-weight block)
source

call-attach-to-blockclj

(call-attach-to-block call block)
source

call-cancelclj

(call-cancel call)
source

call-discardclj

(call-discard call)
source

call-indexclj

(call-index block id)
source

call-make-ancestorsclj

(call-make-ancestors call)
source

call-releaseclj

(call-release call)
source

call-slotclj

(call-slot call)
source

call-slot-bufferclj

source

call-slot-childrenclj

source

call-slot-parentclj

source

call-slot-processclj

source

call-slot-queueclj

source

call-slot-readerclj

source

call-slot-weightclj

source

call-slotsclj

source

call-spawnclj

(call-spawn call)
source

call-transferclj

(call-transfer call diff)
source

call-update-weightsclj

(call-update-weights call delta)
source

call-weightclj

(call-weight call)
source

changeclj

(change item diff)
source

createclj

(create peer)
source

current-sizeclj

(current-size reader)
source

detach-rootclj

(detach-root block id)
source

enqueue-callclj

(enqueue-call reader call)
source

enqueue-itemclj

(enqueue-item reader item)
source

ensure-capacityclj

(ensure-capacity buffer cap)
source

enterclj

(enter state)
source

errorclj

(error msg)
source

exitclj

(exit state held)
source

get-blockclj

(get-block reader frame)
source

item-attach-to-blockclj

(item-attach-to-block item block id diff)
source

item-attach-to-treeclj

(item-attach-to-tree item reader diff)
source

item-cancelclj

(item-cancel item)
source

item-detach-from-treeclj

(item-detach-from-tree item diff)
source

item-slot-parentclj

source

item-slot-queueclj

source

item-slot-stateclj

source

item-slot-tagclj

source

item-slotsclj

source

local-block-offsetclj

(local-block-offset call index)
source

local-call-indexclj

(local-call-index block index)
source

make-blockclj

(make-block reader frame)
source

make-callclj

(make-call reader child)
source

reader-cancelclj

(reader-cancel reader)
source

reader-eventclj

(reader-event reader)
source

reader-pendingclj

(reader-pending reader)
source

reader-slot-aliveclj

source

reader-slot-blocksclj

source

reader-slot-call-queueclj

source

reader-slot-doneclj

source

reader-slot-item-queueclj

source

reader-slot-pendingclj

source

reader-slot-rootclj

source

reader-slot-stateclj

source

reader-slot-stepclj

source

reader-slotsclj

source

reader-spawnclj

(reader-spawn state step done)
source

reader-transferclj

(reader-transfer reader)
source

root-downclj

(root-down call)
source

root-upclj

(root-up call diff)
source

slot-itemsclj

source

slot-lockclj

source

slot-peerclj

source

slot-pendingclj

source

slot-readerclj

source

slotsclj

source

swap-indicesclj

(swap-indices call i j)
source

terminateclj

(terminate reader)
source

unlockclj

(unlock state held)
source

update-local-weightsclj

(update-local-weights weights id delta)
source

update-weightsclj

(update-weights block id delta)
source

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

× close