[−][src]Trait trawler::LobstersClient
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.
Associated Types
type Error: Debug + Send + 'static
Errors produced by the client.
If any errors are produced, they are generally printed rather than returned.
type SetupFuture: Future<Output = Result<(), Self::Error>> + Send + 'static
A future that will resolve once setup has finished.
type RequestFuture: Future<Output = Result<(), Self::Error>> + Send + 'static
A future that will resolve once a request has finished processing.
Required methods
fn setup(&mut self) -> Self::SetupFuture
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.
fn handle(
&mut self,
user: Option<UserId>,
request: LobstersRequest,
priming: bool
) -> Self::RequestFuture
&mut self,
user: Option<UserId>,
request: LobstersRequest,
priming: bool
) -> Self::RequestFuture
Handle the given lobste.rs request, made on behalf of the given user, returning a future that resolves when the request has been satisfied.
The priming
argument is set to true if the request is being issued just to populate the
database. In this case, the backend need only issue writes and not do any other processing
normally associated with the given request
.