pub struct RefreshService {
pub store: Arc<TableStore>,
pub signals: Receiver<RefreshSignal>,
/* private fields */
}Expand description
刷新服务句柄:持有表快照库、信号接收端与各表任务(drop 时中止全部任务)。
Fields§
§store: Arc<TableStore>表快照库(当前代数据在此;调用者随时 snapshot pull)。
signals: Receiver<RefreshSignal>信号接收端(每表独立计时、换代完成即通知,顺序不保证)。
Implementations§
Source§impl RefreshService
impl RefreshService
Sourcepub fn spawn(specs: Vec<RefreshSpec>) -> Self
pub fn spawn(specs: Vec<RefreshSpec>) -> Self
以给定规格启动服务(内部新建空快照库)。需在 tokio runtime 内调用
(内部 tokio::spawn);空规格 = 无任务、信号通道即闭。宿主持有本句柄:
drop / Self::shutdown 会中止全部刷新任务(信号通道随之关闭)。
Sourcepub fn spawn_with_store(specs: Vec<RefreshSpec>, store: Arc<TableStore>) -> Self
pub fn spawn_with_store(specs: Vec<RefreshSpec>, store: Arc<TableStore>) -> Self
以给定规格与共享快照库启动:调用者(如引擎)先在启动期用自己的同步
装载 seed 同一 store(load_rows + TableStore::insert),运行期每次
tick 换代 + 信号都落在这个 store——启动与刷新的数据天然同源、同一交付面。
同名 spec 只保留首个(重复登记 = 两个并行 ticker 换代同一表,查询耗时
差异会让旧代覆盖新代);空规格 = 无任务、信号通道即闭。
Trait Implementations§
Source§impl Drop for RefreshService
impl Drop for RefreshService
Auto Trait Implementations§
impl Freeze for RefreshService
impl RefUnwindSafe for RefreshService
impl Send for RefreshService
impl Sync for RefreshService
impl Unpin for RefreshService
impl UnsafeUnpin for RefreshService
impl UnwindSafe for RefreshService
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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