pub struct BucketDomainsQueryerBuilder { /* private fields */ }
Expand description
存储空间绑定域名查询构建器
Implementations§
source§impl BucketDomainsQueryerBuilder
impl BucketDomainsQueryerBuilder
sourcepub fn http_client(&mut self, http_client: HttpClient) -> &mut Self
pub fn http_client(&mut self, http_client: HttpClient) -> &mut Self
设置 HTTP 客户端
sourcepub fn uc_endpoints(&mut self, uc_endpoints: impl Into<Endpoints>) -> &mut Self
pub fn uc_endpoints(&mut self, uc_endpoints: impl Into<Endpoints>) -> &mut Self
设置存储空间管理终端地址列表
sourcepub fn cache_lifetime(&mut self, cache_lifetime: Duration) -> &mut Self
pub fn cache_lifetime(&mut self, cache_lifetime: Duration) -> &mut Self
缓存时长
sourcepub fn shrink_interval(&mut self, shrink_interval: Duration) -> &mut Self
pub fn shrink_interval(&mut self, shrink_interval: Duration) -> &mut Self
清理间隔时长
sourcepub fn load_or_create_from(
&mut self,
path: impl AsRef<Path>,
auto_persistent: bool
) -> BucketDomainsQueryer
pub fn load_or_create_from(
&mut self,
path: impl AsRef<Path>,
auto_persistent: bool
) -> BucketDomainsQueryer
从文件系统加载或构建存储空间绑定域名查询器
可以选择是否启用自动持久化缓存功能
sourcepub fn build(&mut self) -> BucketDomainsQueryer
pub fn build(&mut self) -> BucketDomainsQueryer
从默认文件系统路径加载或构建存储空间绑定域名查询器,并启用自动持久化缓存功能
sourcepub fn default_load_or_create_from(
&mut self,
auto_persistent: bool
) -> BucketDomainsQueryer
pub fn default_load_or_create_from(
&mut self,
auto_persistent: bool
) -> BucketDomainsQueryer
从默认文件系统路径加载或构建存储空间绑定域名查询器
可以选择是否启用自动持久化缓存功能
Examples found in repository?
src/regions/endpoints_provider/bucket_domains_provider.rs (line 113)
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
fn default() -> Self {
Self::builder().default_load_or_create_from(true)
}
}
impl Default for BucketDomainsQueryerBuilder {
#[inline]
fn default() -> Self {
Self {
http_client: None,
uc_endpoints: None,
cache_lifetime: DEFAULT_CACHE_LIFETIME,
shrink_interval: DEFAULT_SHRINK_INTERVAL,
}
}
}
impl BucketDomainsQueryerBuilder {
/// 创建存储空间绑定域名查询构建器
#[inline]
pub fn new() -> Self {
Self::default()
}
/// 设置 HTTP 客户端
#[inline]
pub fn http_client(&mut self, http_client: HttpClient) -> &mut Self {
self.http_client = Some(http_client);
self
}
/// 是否启用 HTTPS 协议
///
/// 默认为 HTTPS 协议
pub fn use_https(&mut self, use_https: bool) -> &mut Self {
self.http_client(HttpClient::build_default().use_https(use_https).build())
}
/// 设置存储空间管理终端地址列表
#[inline]
pub fn uc_endpoints(&mut self, uc_endpoints: impl Into<Endpoints>) -> &mut Self {
self.uc_endpoints = Some(uc_endpoints.into());
self
}
/// 缓存时长
#[inline]
pub fn cache_lifetime(&mut self, cache_lifetime: Duration) -> &mut Self {
self.cache_lifetime = cache_lifetime;
self
}
/// 清理间隔时长
#[inline]
pub fn shrink_interval(&mut self, shrink_interval: Duration) -> &mut Self {
self.shrink_interval = shrink_interval;
self
}
/// 从文件系统加载或构建存储空间绑定域名查询器
///
/// 可以选择是否启用自动持久化缓存功能
pub fn load_or_create_from(&mut self, path: impl AsRef<Path>, auto_persistent: bool) -> BucketDomainsQueryer {
let owned = take(self);
BucketDomainsQueryer {
cache: EndpointsCache::load_or_create_from(
path.as_ref(),
auto_persistent,
owned.cache_lifetime,
owned.shrink_interval,
),
http_client: owned.http_client.unwrap_or_default(),
uc_endpoints: owned
.uc_endpoints
.unwrap_or_else(|| Endpoints::public_uc_endpoints().to_owned()),
}
}
/// 从默认文件系统路径加载或构建存储空间绑定域名查询器,并启用自动持久化缓存功能
#[inline]
pub fn build(&mut self) -> BucketDomainsQueryer {
self.default_load_or_create_from(true)
}
sourcepub fn in_memory(&mut self) -> BucketDomainsQueryer
pub fn in_memory(&mut self) -> BucketDomainsQueryer
构建存储空间绑定域名查询器
不启用文件系统持久化缓存
Trait Implementations§
source§impl Clone for BucketDomainsQueryerBuilder
impl Clone for BucketDomainsQueryerBuilder
source§fn clone(&self) -> BucketDomainsQueryerBuilder
fn clone(&self) -> BucketDomainsQueryerBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BucketDomainsQueryerBuilder
impl Debug for BucketDomainsQueryerBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for BucketDomainsQueryerBuilder
impl Send for BucketDomainsQueryerBuilder
impl Sync for BucketDomainsQueryerBuilder
impl Unpin for BucketDomainsQueryerBuilder
impl !UnwindSafe for BucketDomainsQueryerBuilder
Blanket Implementations§
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> 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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Immutable access to the
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Immutable access to the
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Mutable access to the
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.