pub struct ElastiCacheRuntime { /* private fields */ }Implementations§
Source§impl ElastiCacheRuntime
impl ElastiCacheRuntime
Sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Construct the Docker/Podman backend. Returns None when no
container CLI is available.
Sourcepub async fn new_k8s(
server_port: u16,
internal_token: String,
) -> Result<Self, BackendInitError>
pub async fn new_k8s( server_port: u16, internal_token: String, ) -> Result<Self, BackendInitError>
Construct the Kubernetes backend. server_port is fakecloud’s
bound port (used when FAKECLOUD_K8S_SELF_URL omits one);
internal_token guards the per-resource RDB endpoint that seeds
snapshot data into restored Redis Pods. Fails fast on
misconfiguration — never silently degrades.
Sourcepub fn pending_rdb(&self) -> Option<PendingRdb>
pub fn pending_rdb(&self) -> Option<PendingRdb>
The pending-RDB map the server’s internal endpoint serves from.
None on the Docker backend (which stages snapshots via the
daemon, not HTTP).
Sourcepub fn endpoint_host(&self) -> &str
pub fn endpoint_host(&self) -> &str
Address fakecloud advertises for clients to reach a spawned cache
container, and uses for readiness probes. 127.0.0.1 on the host;
host.docker.internal when fakecloud is containerized (issue
#1539, bug 0.4). Only meaningful for the Docker backend (k8s
addresses are per-Pod and returned from ensure_*).
pub async fn ensure_redis( &self, resource_id: &str, rdb_path: Option<&str>, tags: &BTreeMap<String, String>, ) -> Result<RunningCacheContainer, RuntimeError>
pub async fn ensure_memcached( &self, resource_id: &str, tags: &BTreeMap<String, String>, ) -> Result<RunningCacheContainer, RuntimeError>
pub async fn stop_container(&self, resource_id: &str)
Sourcepub async fn remove_data_volume(&self, resource_id: &str)
pub async fn remove_data_volume(&self, resource_id: &str)
Remove the persisted redis/valkey data volume for a resource. Called on delete so a later resource reusing the identifier starts clean instead of reloading the deleted resource’s RDB. No-op on the k8s backend (PVC lifecycle is handled there) and for memcached (no volume).
Sourcepub async fn restart_container(
&self,
resource_id: &str,
tags: &BTreeMap<String, String>,
) -> Result<(), RuntimeError>
pub async fn restart_container( &self, resource_id: &str, tags: &BTreeMap<String, String>, ) -> Result<(), RuntimeError>
Restart the underlying backing instance, mirroring real
ElastiCache’s RebootCacheCluster behaviour. Returns Unavailable
if the resource has no live instance tracked here.
Sourcepub async fn exec_redis(
&self,
resource_id: &str,
redis_args: &[String],
) -> Result<CacheExec, RuntimeError>
pub async fn exec_redis( &self, resource_id: &str, redis_args: &[String], ) -> Result<CacheExec, RuntimeError>
Execute a redis-cli command inside a tracked instance.
Sourcepub async fn dump_rdb(
&self,
resource_id: &str,
dest_path: &str,
) -> Result<(), RuntimeError>
pub async fn dump_rdb( &self, resource_id: &str, dest_path: &str, ) -> Result<(), RuntimeError>
Trigger SAVE inside a running Redis instance and copy the
resulting dump.rdb out to dest_path.
pub async fn stop_all(&self)
Sourcepub async fn reap_stale(&self)
pub async fn reap_stale(&self)
Sweep cache Pods orphaned by a previous fakecloud process (k8s only; the Docker backend relies on the shared reaper).
Trait Implementations§
Source§impl Clone for ElastiCacheRuntime
impl Clone for ElastiCacheRuntime
Source§fn clone(&self) -> ElastiCacheRuntime
fn clone(&self) -> ElastiCacheRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ElastiCacheRuntime
impl !UnwindSafe for ElastiCacheRuntime
impl Freeze for ElastiCacheRuntime
impl Send for ElastiCacheRuntime
impl Sync for ElastiCacheRuntime
impl Unpin for ElastiCacheRuntime
impl UnsafeUnpin for ElastiCacheRuntime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more