Skip to main content

RefreshService

Struct RefreshService 

Source
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

Source

pub fn spawn(specs: Vec<RefreshSpec>) -> Self

以给定规格启动服务(内部新建空快照库)。需在 tokio runtime 内调用 (内部 tokio::spawn);空规格 = 无任务、信号通道即闭。宿主持有本句柄: drop / Self::shutdown 会中止全部刷新任务(信号通道随之关闭)。

Source

pub fn spawn_with_store(specs: Vec<RefreshSpec>, store: Arc<TableStore>) -> Self

以给定规格与共享快照库启动:调用者(如引擎)先在启动期用自己的同步 装载 seed 同一 store(load_rows + TableStore::insert),运行期每次 tick 换代 + 信号都落在这个 store——启动与刷新的数据天然同源、同一交付面。 同名 spec 只保留首个(重复登记 = 两个并行 ticker 换代同一表,查询耗时 差异会让旧代覆盖新代);空规格 = 无任务、信号通道即闭。

Source

pub fn shutdown(&mut self)

中止全部刷新任务(等价于 drop,信号通道随后关闭)。

Trait Implementations§

Source§

impl Drop for RefreshService

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> UnsafeAny for T
where T: Any,

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more