Struct lava_api::Lava

source ·
pub struct Lava { /* private fields */ }
Expand description

A local proxy for a LAVA server

This provides convenient access to some of the data stored on a LAVA server, including jobs, devices, tags and workers.

Implementations§

source§

impl Lava

source

pub fn new(url: &str, token: Option<String>) -> Result<Lava, LavaError>

Create a new Lava proxy

Here url is the address of the server, and token is an optional LAVA security token used to validate access.

source

pub async fn refresh_tags(&self) -> Result<(), PaginationError>

Refresh the tag cache

Tags are cached to make lookup cheaper, and because the number of jobs can be very large: resolving tags individually for each job would be extremely slow. The cache has to be periodically refreshed to account for changes.

Note that tags are automatically refreshed by calling tag or tags, but not by calling devices or jobs.

source

pub async fn tag(&self, tag: u32) -> Option<Tag>

Retrieve the Tag for the given tag id.

source

pub async fn tags(&self) -> Result<Vec<Tag>, PaginationError>

Retrieve all the tags from the server

The returned data is not a stream, but a flat vector when the method succeeds. This also updates the tag cache.

source

pub fn devices(&self) -> Devices<'_>

Obtain a Stream of all the Device instances on the server.

source

pub fn log(&self, id: i64) -> JobLogBuilder<'_>

source

pub fn jobs(&self) -> JobsBuilder<'_>

Obtain a customisable query object for Job instances on the server.

The returned JobsBuilder can be used first to select the subset of jobs that will be returned, and then after that is complete to obtain a stream of matching jobs. The default query is the same as that for JobsBuilder::new.

source

pub async fn submit_job( &self, definition: &str ) -> Result<Vec<i64>, SubmissionError>

source

pub async fn cancel_job(&self, id: i64) -> Result<(), CancellationError>

source

pub async fn job_results_as_junit( &self, id: i64 ) -> Result<impl Stream<Item = Result<Bytes, ResultsError>> + '_, ResultsError>

source

pub fn workers(&self) -> Paginator<Worker>

Obtain a Stream of all the Worker instances on the server.

source

pub fn test_cases(&self, job_id: i64) -> Paginator<TestCase>

Obtain a Stream of all the TestCase instances for a given job id.

Trait Implementations§

source§

impl Debug for Lava

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Lava

§

impl Send for Lava

§

impl Sync for Lava

§

impl Unpin for Lava

§

impl !UnwindSafe for Lava

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more