jepsen.client

Applies operations to a database.

Client

protocol

members

close!

(close! client test)

Close the client connection when work is completed or an invocation crashes the client. Close should not affect the logical state of the test.

invoke!

(invoke! client test operation)

Apply an operation to the client, returning an operation to be appended to the history. For multi-stage operations, the client may reach into the test and conj onto the history atom directly.

open!

(open! client test node)

Set up the client to work with a particular node. Returns a client which is ready to accept operations via invoke! Open should not affect the logical state of the test; it should not, for instance, modify tables or insert records.

setup!

(setup! client test)

Called to set up database state for testing.

teardown!

(teardown! client test)

Tear down database state when work is complete.

closable?

(closable? client)

Returns true if the given client implements method close!.

is-reusable?

(is-reusable? client test)

Wrapper around reusable?; returns false when not implemented.

noop

Does nothing.

Reusable

protocol

members

reusable?

(reusable? client test)

If true, this client can be re-used with a fresh process after a call to invoke throws or returns an info operation. If false (or if this protocol is not implemented), crashed clients will be closed and new ones opened to replace them.

timeout

(timeout timeout-or-fn client)

Sometimes a client library’s own timeouts don’t work reliably. This takes either a timeout as a number of ms, or a function (f op) => timeout-in-ms, and a client. Wraps that client in a new one which automatically times out operations that take longer than the given timeout. Timed out operations have :error :jepsen.client/timeout.

validate

(validate client)

Wraps a client, validating that its return types are what you’d expect.

with-client

macro

(with-client [client-sym client-expr] & body)

Analogous to with-open. Takes a binding of the form client-sym client-expr, and a body. Binds client-sym to client-expr (presumably, client-expr opens a new client), evaluates body with client-sym bound, and ensures client is closed before returning.