OxL Справочник OxL
РусскийEnglish

fn publishOf

Stores one element of a topic and returns when the store has accepted it. The generated T.publish(x) calls it.

Example:

oxl✓ проверяется в CI
data Job { id: i64 }

topic Jobs: Job

cluster demo {
  role store { journal }
}

fn main() io, db {
  match Jobs.publish(Job{ id: 1 }) {
    TopicError e => print("not stored: {e.msg}")
    _ => print("stored")
  }
}
Вывод
stored
pub(api) fn publishOf<T: Serializable>(h: i64, x: &T, key: bytes) -> () | TopicError  db

Сложность. O(size of the element) plus one replicated write.

С версии. 1.0.0-beta

Параметры

ИмяТип
hi64
x&T
keybytes

Возвращает

()

Ошибки

  • TopicError @error
  • `TopicError` (`Unavailable` nothing was stored, `Unknown` the outcome is unknown, `AccessDenied` the policy refuses, `Other` the element cannot be encoded).

Эффекты

db

Определено в: std/topic/topic.oxl:214

См. также