[][src]Trait trawler::LobstersClient

pub trait LobstersClient {
    type Error: Debug + Send + 'static;
    type SetupFuture: Future<Output = Result<(), Self::Error>> + Send + 'static;
    type RequestFuture: Future<Output = Result<(), Self::Error>> + Send + 'static;
    fn setup(&mut self) -> Self::SetupFuture;
fn handle(
        &mut self,
        user: Option<UserId>,
        request: LobstersRequest
    ) -> Self::RequestFuture; }

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.

Loading content...

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
) -> 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.

Loading content...

Implementors

Loading content...