This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sort" | |
"time" | |
) | |
// P is a latency variable that has emits a configured duration 99% of the time, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2012 Viktor Klang | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest create-cas-test | |
(let [test (run! | |
(assoc | |
noop-test | |
:name "foundationdb" | |
:os ubuntu/os | |
:db db | |
:client (cas-register) | |
:model (model/cas-register) | |
:checker (checker/compose {:html timeline/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:cas (timeout 5000 (assoc op :type :info :value :timed-out) | |
(let [cas (reify Function | |
(apply [this, tr] | |
(let [ | |
[value value'] (:value op) | |
key_var (byte-array (map byte key)) | |
old_value (.getLong (Tuple/fromBytes (.get (.get tr (byte-array (map byte key))))) 0) | |
new_value (.pack (Tuple/from (into-array [value'])))] | |
(if (= old_value value) | |
(do |