PurrGress Major 0.6 Update

CHANGELOG v0.6.0

English

(major break of the command protocol + removal of the byte codec — the actor model is now 100% actor)

  • launch - now self.main_train.extend_from_slice(branch), instead of self.main_train.extend(branch.clone()), since branch (RouteBox) supports Copy

  • in PurrSiding, main_train renamed to main_line

  • in PurrSiding, change_rule - cut in the usual sense

  • in PurrSiding, the switches field completely removed as unneeded and inconvenient

  • in PurrSiding, cut: find_index_few, find_index, find_index_many, get_switches, clear_switches - meant for working with switches

  • in PurrSiding, new methods change_rule and change_rule_few, which behave smarter, working with rules directly without unnecessary collecting

  • in PurrDesign, chain was renamed to design_chain, and new_chain to chain - since it's a more fitting form of addition

  • added TrainError<T> and TrainResult<V, T> - now every function from the train section returns TrainResult

  • PurrError from the dispatcher section renamed to DispatcherError

  • RouteAction and DispatcherCommand are now Copy

  • DispatcherCommand:

    • Attach
    • Replace
    • RerouteAt

    now take carriage: T instead of Vec<T, U> under the hood, or Bytes in the original

  • PurrDispatcher::dispatch - got dumber, no longer handles Attach / Replace / RerouteAt - you're on your own with those now. And it no longer returns Option<C> (key), but:

#[derive(Debug, Clone, Copy, MakeFull)]
pub struct DispatchData<T: PurrStep, C: PurrKey> {
    #[None] pub command: Option<DispatcherCommand<T, C>>,
    #[None] pub key: Option<C>,
    #[None] pub carriage: Option<T>,
    #[None] pub insert_position: Option<InsertPosition>,
    #[None] pub line_length: Option<usize>,
    #[None] pub action: Option<RouteAction>
}

with all possible data

  • the error enum now looks like this:
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DispatcherError {
    DuplicateInFastRoutes,
    DuplicateInDynamicRoutes,
    CursorNotFound,
    LineChannelClosed,
    RouteChannelClosed,
    Internal(String),
}

LineChannelClosed and RouteChannelClosed are new: Line channel is closed, receiver dropped and Route reply channel is closed, receiver dropped

  • bytes and rkyv fully removed as a standard for the dispatcher
  • train_codec - the dispatcher's deserialization/byte-handling section fully removed from the lib

Easier client-side work - no more need to think about bytes or routes inside every client

Harder dispatcher structure and flow, since now you're required to manually handle Attach / Replace / RerouteAt commands, and the design - route - siding blueprint work moved into the dispatcher's own flow

Massive allocation optimization inside the dispatcher and stations, and in my opinion - easier work and more control, but also more responsibility.

I WILL NOT SHOVE ROUTING TIES INSIDE THE DISPATCHER. I'M FOR EXPLICIT UNDERSTANDING OF HOW THE TRACK AND DATA STORAGE WORK. SORRY.

Русский

(мажорный слом протокола команд + удаление байткодека — акторная модель теперь на 100% акторная)

  • launch - теперь self.main_train.extend_from_slice(branch), а не self.main_train.extend(branch.clone()), так как branch (RouteBox) поддерживает Copy

  • в PurrSiding, main_train переименован в main_line

  • в PurrSiding, change_rule - вырезана в привычном смысле

  • в PurrSiding, поле switches полностью вырезано за ненадобностью и неудобством

  • в PurrSiding, вырезаны: find_index_few, find_index, find_index_many, get_switches, clear_switches - предназначенные для работы с switches

  • в PurrSiding, новые методы change_rule и change_rule_few, которые ведут себя более умно, сразу работая с правилами без лишнего сбора

  • в PurrDesign, chain был переименован в design_chain, а new_chain в chain - так как является более ликвидной формой добавления

  • добавлен TrainError<T> и TrainResult<V, T> - теперь все функции из train-раздела возращают именно TrainResult

  • PurrError из раздела dispatcher переименован в DispatcherError

  • RouteAction и DispatcherCommand теперь Copy

  • DispatcherCommand:

    • Attach
    • Replace
    • RerouteAt

    теперь принимают carriage: T вместо Vec<T, U> под катом или Bytes в оригинале

  • PurrDispatcher::dispatch - стал более глупым, больше не работает с Attach / Replace / RerouteAt — вы сами обязаны с ними работать. А возращает больше не Option<C> (key), а:

#[derive(Debug, Clone, Copy, MakeFull)]
pub struct DispatchData<T: PurrStep, C: PurrKey> {
    #[None] pub command: Option<DispatcherCommand<T, C>>,
    #[None] pub key: Option<C>,
    #[None] pub carriage: Option<T>,
    #[None] pub insert_position: Option<InsertPosition>,
    #[None] pub line_length: Option<usize>,
    #[None] pub action: Option<RouteAction>
}

со всеми возможными данными

  • энум ошибок теперь выглядит так:
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DispatcherError {
    DuplicateInFastRoutes,
    DuplicateInDynamicRoutes,
    CursorNotFound,
    LineChannelClosed,
    RouteChannelClosed,
    Internal(String),
}

LineChannelClosed и RouteChannelClosed - новые: Line channel is closed, receiver dropped и Route reply channel is closed, receiver dropped

  • bytes и rkyv полностью удалены как стандарт для диспетчера
  • train_codec - раздел диспетчера по десериализации и работе с байтами полностью удален из либы

Облегчение работы с клиентами - больше не нужно задумываться о байтах и маршрутах внутри каждого клиента

Усложнение структуры и потока диспетчера, так как теперь вы обязаны вручную обрабатывать команды Attach / Replace / RerouteAt, так же работа с чертежами design - route - siding переехала внутрь потока диспетчера

Гигантская оптимизация аллокаций внутри диспетчера и станций, и по моему мнению - облегчение работы и больше контроля, но и больше ответственности.

Я НЕ БУДУ СУВАТЬ МАРШРУТНЫЕ СВЯЗИ ВНУТРЬ ДИСПЕТЧЕРА. Я ЗА ЯВНОЕ ПОНИМАНИЕ РАБОТЫ ТРЕКА И ХРАНЕНИЯ ИНФОРМАЦИИ. ПРОСТИТЕ.