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()?}")
}Output
2
pub(api) fn countOf(h: i64) -> i64 | TopicError dbComplexity. O(partitions).
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
h | i64 |
Returns
i64
Errors
TopicError@error- `TopicError` when the store is not reachable.
Effects
db
Defined in: std/topic/topic.oxl:447