Trait trawler::LobstersClient [] [src]

pub trait LobstersClient {
    type Factory;
    fn spawn(_: &mut Self::Factory, _: &Handle) -> Self;
fn handle(
        _: Rc<Self>,
        _: Option<UserId>,
        _: LobstersRequest
    ) -> Box<Future<Item = Duration, Error = ()>>; fn setup(&mut Self::Factory) { ... } }

Implementors of this trait handle [LobstersRequest] that correspond to "real" lobste.rs website requests queued up by the workload generator.

Note that the workload generator does not check that the implementor correctly perform the queries corresponding to each request; this must be verified with manual inspection of the Rails application or its query logs.

In order to allow generating more load, the load generator spins up multiple "issuers" that each have their own LobstersClient. The associated Factory type tells the generator how to spawn more clients.

Associated Types

The type used to spawn more clients of this type.

Required Methods

Spawn a new client for an issuer running the given tokio reactor.

Handle the given lobste.rs request, made on behalf of the given user, returning a future that resolves when the request has been satisfied.

Provided Methods

Set up a fresh instance of the backend before priming.

Implementing this allows benchmarking a backend without ever running the lobste.rs application. Normally, a backend would need to run the lobsters setup routine:

$ rails db:drop
$ rails db:create
$ rails db:schema:load
$ rails db:seed

The default implementation of this method just prints an informational message saying that the backend was not re-created.

Implementors