pub struct BotSession {
    pub name: String,
    pub bot_id: String,
    pub status: i32,
    pub worker: Option<Worker>,
    pub leases: Vec<Lease>,
    pub expire_time: Option<Timestamp>,
    pub version: String,
}
Expand description

A bot session represents the state of a bot while in continuous contact with the server for a period of time. The session includes information about the worker - that is, the worker (the physical or virtual hardware) is considered to be a property of the bot (the software agent running on that hardware), which is the reverse of real life, but more natural from the point of the view of this API, which communicates solely with the bot and not directly with the underlying worker.

Fields§

§name: String

The bot session name, as selected by the server. Output only during a call to CreateBotSession.

§bot_id: String

A unique bot ID within the farm used to persistently identify this bot over time (i.e., over multiple sessions). This ID must be unique within a farm. Typically, the bot ID will be the same as the name of the primary device in the worker (e.g., what you’d get from typing uname -n on *nix), but this is not required since a single device may allow multiple bots to run on it, each with access to different resources. What is important is that this ID is meaningful to humans, who might need to hunt a physical machine down to fix it.

When CreateBotSession is successfully called with a bot_id, all prior sessions with the same ID are invalidated. If a bot attempts to update an invalid session, the server must reject that request, and may also quarantine the other bot with the same bot IDs (ie, stop sending it new leases and alert an admin).

§status: i32

The status of the bot. This must be populated in every call to UpdateBotSession.

§worker: Option<Worker>

A description of the worker hosting this bot. The Worker message is used here in the Status context (see Worker for more information). If multiple bots are running on the worker, this field should only describe the resources accessible from this bot.

During the call to CreateBotSession, the server may make arbitrary changes to the worker’s server_properties field (see that field for more information). Otherwise, this field is input-only.

§leases: Vec<Lease>

A list of all leases that are a part of this session. See the Lease message for details.

§expire_time: Option<Timestamp>

The time at which this bot session will expire, unless the bot calls UpdateBotSession again. Output only.

§version: String

The version of the bot code currently running. The server may use this information to issue an admin action to tell the bot to update itself.

Implementations§

source§

impl BotSession

source

pub fn status(&self) -> BotStatus

Returns the enum value of status, or the default if the field is set to an invalid enum value.

source

pub fn set_status(&mut self, value: BotStatus)

Sets status to the provided enum value.

Trait Implementations§

source§

impl Clone for BotSession

source§

fn clone(&self) -> BotSession

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BotSession

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for BotSession

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Message for BotSession

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for BotSession

source§

fn eq(&self, other: &BotSession) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for BotSession

Auto Trait Implementations§

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> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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