fn publishOf
Stores one element of a topic and returns when the store has accepted it. The generated T.publish(x) calls it.
Example:
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
Параметры
| Имя | Тип |
|---|---|
h | i64 |
x | &T |
key | bytes |
Возвращает
()
Ошибки
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