pub struct Sdk { /* private fields */ }
Expand description
SDK is an instance of the Agones SDK
Implementations§
source§impl Sdk
impl Sdk
sourcepub async fn connect(
port: Option<u16>,
connect_timeout: Option<Duration>,
keep_alive: Option<Duration>
) -> Result<(Self, GameServer)>
pub async fn connect( port: Option<u16>, connect_timeout: Option<Duration>, keep_alive: Option<Duration> ) -> Result<(Self, GameServer)>
Starts a new SDK instance, and connects to localhost on the port
specified
or else falls back to the AGONES_SDK_GRPC_PORT
environment variable,
or defaults to 9357.
The connect_timeout
applies to the time it takes to perform the initial
connection as well as the handshake with the agones sidecar.
Errors
- The port specified in
AGONES_SDK_GRPC_PORT
can’t be parsed as au16
. - A connection cannot be established with an Agones SDK server
- The handshake takes longer than the specified
handshake_timeout
duration
sourcepub async fn mark_ready(&mut self) -> Result<()>
pub async fn mark_ready(&mut self) -> Result<()>
Marks the Game Server as ready to receive connections
sourcepub fn health_check(&self) -> Sender<()>
pub fn health_check(&self) -> Sender<()>
Returns a tokio::sync::mpsc::Sender
that will emit a health check every time a message is sent on the channel.
sourcepub async fn set_label(
&mut self,
key: impl Into<String>,
value: impl Into<String>
) -> Result<()>
pub async fn set_label( &mut self, key: impl Into<String>, value: impl Into<String> ) -> Result<()>
Set a Label value on the backing Game Server record that is stored in Kubernetes
sourcepub async fn set_annotation(
&mut self,
key: impl Into<String>,
value: impl Into<String>
) -> Result<()>
pub async fn set_annotation( &mut self, key: impl Into<String>, value: impl Into<String> ) -> Result<()>
Set an Annotation value on the backing Game Server record that is stored in Kubernetes
sourcepub async fn get_gameserver(&mut self) -> Result<GameServer>
pub async fn get_gameserver(&mut self) -> Result<GameServer>
Returns most of the backing Game Server configuration and Status
sourcepub async fn reserve(&mut self, duration: Duration) -> Result<()>
pub async fn reserve(&mut self, duration: Duration) -> Result<()>
Reserve marks the Game Server as Reserved for a given duration, at which point it will return the Game Server to a Ready state.
Note that the smallest reserve duration is 1 second and is limited to second resolution.
sourcepub async fn watch_gameserver(
&mut self
) -> Result<impl Stream<Item = Result<GameServer>>>
pub async fn watch_gameserver( &mut self ) -> Result<impl Stream<Item = Result<GameServer>>>
Watch the backing Game Server configuration on updated
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Sdk
impl Send for Sdk
impl Sync for Sdk
impl Unpin for Sdk
impl !UnwindSafe for Sdk
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request