fn countOf
The number of elements the topic still holds (retention removes the older ones). The generated T.count() calls it.
Example:
data Job { id: i64 }
topic Jobs: Job
cluster demo {
role store { journal }
}
fn main() -> () | TopicError io, db {
Jobs.publish(Job{ id: 1 })?
Jobs.publish(Job{ id: 2 })?
print("{Jobs.count()?}")
}Вывод
2
pub(api) fn countOf(h: i64) -> i64 | TopicError dbСложность. O(partitions).
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
h | i64 |
Возвращает
i64
Ошибки
TopicError@error- `TopicError` when the store is not reachable.
Эффекты
db
Определено в: std/topic/topic.oxl:447