Trait trawler::LobstersClient
source · pub trait LobstersClient {
type Factory;
fn spawn(_: &mut Self::Factory, _: &Handle) -> Self;
fn handle(
_: Rc<Self>,
_: Option<UserId>,
_: LobstersRequest
) -> Box<dyn Future<Item = Duration, Error = ()>>;
fn setup(: &mut Self::Factory) { ... }
}
Expand description
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.
Required Associated Types
Required Methods
Provided Methods
sourcefn setup(: &mut Self::Factory)
fn setup(: &mut Self::Factory)
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.