Operations on histories
Operations on histories
(complete history)
When a request is initiated, we may not know what the result will be--but find out when it completes. In the history, this might look like
[{:type :invoke :f :read :value nil} ; We don't know what we're going to read. {:type :ok :f :read :value 2}] ; We received 2.
This function fills in missing values for invocations, where those requests complete. It constructs a new history in which we 'already knew' what the results of successful operations would have been.
For failed operations, complete fills in the value for both invocation and completion; depending on whichever has a value available. We also add a :fails? key to invocations which will fail, allowing checkers to skip them.
When a request is initiated, we may not know what the result will be--but find out when it completes. In the history, this might look like [{:type :invoke :f :read :value nil} ; We don't know what we're going to read. {:type :ok :f :read :value 2}] ; We received 2. This function fills in missing values for invocations, where those requests complete. It constructs a new history in which we 'already knew' what the results of successful operations would have been. For failed operations, complete fills in the value for both invocation and completion; depending on whichever has a value available. We *also* add a :fails? key to invocations which will fail, allowing checkers to skip them.
(complete-fold-op [history index] op)
Folds an operation into a completed history, keeping track of outstanding invocations.
History is our complete history of operations: a transient vector. Index is a transient map of processes to the index of their most recent invocation. Note that we assume processes are singlethreaded; e.g. they do not perform multiple invocations without receiving responses.
Folds an operation into a completed history, keeping track of outstanding invocations. History is our complete history of operations: a transient vector. Index is a transient map of processes to the index of their most recent invocation. Note that we assume processes are singlethreaded; e.g. they do not perform multiple invocations without receiving responses.
(completion pair-index op)
Returns the completion for an op, using a pair index. If the op is itself a completion, returns the op. If the op is an invocation, looks up its completion in the pair index. Infos map to nil.
Returns the completion for an op, using a pair index. If the op is itself a completion, returns the op. If the op is an invocation, looks up its completion in the pair index. Infos map to nil.
(index history)
Attaches an :index key to each element of the history, identifying its position in the history vector.
Attaches an :index key to each element of the history, identifying its position in the history vector.
(invocation pair-index op)
Returns the invocation for an op, using a pair index. If the op is itself a completion, returns the op. If the op is an invocation, looks up its completion in the pair index. Infos map to nil.
Returns the invocation for an op, using a pair index. If the op is itself a completion, returns the op. If the op is an invocation, looks up its completion in the pair index. Infos map to nil.
(pair-index history)
Given a history, constructs a map from operations to their counterparts--invocations to their completions or completions to their invocations. Infos map to nil.
Given a history, constructs a map from operations to their counterparts--invocations to their completions or completions to their invocations. Infos map to nil.
(pairs history)
(pairs invocations [op & ops])
Pairs up ops from each process in a history. Yields a lazy sequence of [info] or [invoke, ok|fail] pairs.
Pairs up ops from each process in a history. Yields a lazy sequence of [info] or [invoke, ok|fail] pairs.
(processes history)
What processes are in a history?
What processes are in a history?
(sort-processes coll)
Sort a collection of processes. Puts numbers second, keywords first.
Sort a collection of processes. Puts numbers second, keywords first.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close