jepsen.nemesis.time

Functions for messing with time and clocks.

bump-gen

Randomized clock bump generator targeting a random subsets of nodes.

bump-gen-select

(bump-gen-select select)

A function which returns a clock bump generator that bumps the clock from -262 to +262 seconds, exponentially distributed. (select test) is used to select which subset of the test’s nodes to use as targets in the generator.

bump-time!

(bump-time! delta)

Adjusts the clock by delta milliseconds. Returns the time offset from the current local wall clock, in seconds.

clock-gen

(clock-gen)

Emits a random schedule of clock skew operations. Always starts by checking the clock offsets to establish an initial bound.

clock-nemesis

(clock-nemesis)

Generates a nemesis which manipulates clocks. Accepts four types of operations:

{:f :reset, :value [node1 ...]}

{:f :strobe, :value {node1 {:delta ms, :period ms, :duration s} ...}}

{:f :bump, :value {node1 delta-ms ...}}

{:f :check-offsets}

clock-offset

(clock-offset remote-time)

Takes a time in seconds since the epoch, and subtracts the local node time, to obtain a relative offset in seconds.

compile!

(compile! reader bin)

Takes a Reader to C source code and spits out a binary to /opt/jepsen/, if it doesn’t already exist.

compile-resource!

(compile-resource! resource bin)

Given a resource name, spits out a binary to /opt/jepsen/.

compile-tools!

(compile-tools!)

current-offset

(current-offset)

Returns the clock offset of this node, in seconds.

dir

Where do we install binaries to?

install!

(install!)

Uploads and compiles some C programs for messing with clocks.

parse-time

(parse-time s)

Parses a decimal time in unix seconds since the epoch, provided as a string, to a bigdecimal

reset-gen

Randomized reset generator. Performs resets on random subsets of the test’s nodes.

reset-gen-select

(reset-gen-select select)

A function which returns a generator of reset operations. Takes a function (select test) which returns nodes from the test we’d like to target for that clock reset.

reset-time!

(reset-time!)(reset-time! test)

Resets the local node’s clock to NTP. If a test is given, resets time on all nodes across the test.

strobe-gen

Randomized clock strobe generator targeting a random subsets of the test’s nodes.

strobe-gen-select

(strobe-gen-select select)

A function which returns a clock strobe generator that introduces clock strobes from 4 ms to 262 seconds, with a period of 1 ms to 1 second, for a duration of 0-32 seconds. (select test) is used to select which subset of the test’s nodes to use as targets in the generator.

strobe-time!

(strobe-time! delta period duration)

Strobes the time back and forth by delta milliseconds, every period milliseconds, for duration seconds.