pub struct Bucket { /* private fields */ }Expand description
A declared module bucket. Keep its BusClient alive for credential upkeep.
Implementations§
Source§impl Bucket
impl Bucket
Sourcepub async fn get(&self, key: &str) -> Result<Option<BucketEntry>>
pub async fn get(&self, key: &str) -> Result<Option<BucketEntry>>
Gets the latest value; absent and deleted keys both return None.
Sourcepub async fn put(&self, key: &str, value: impl Into<Bytes>) -> Result<u64>
pub async fn put(&self, key: &str, value: impl Into<Bytes>) -> Result<u64>
Writes as the declared owner, refusing oversized values before any request.
Sourcepub async fn delete(&self, key: &str) -> Result<u64>
pub async fn delete(&self, key: &str) -> Result<u64>
Stores a retained delete marker and returns its publish acknowledgement’s revision.
Sourcepub async fn watch(&self) -> Result<BucketWatch>
pub async fn watch(&self) -> Result<BucketWatch>
Delivers current entries, one CaughtUp marker (even when empty), then changes. Uses only unnamed ephemeral consumers; dropped watches release their slots after the server’s 30-second inactivity threshold, not immediately. New watches fail immediately with WatchCapacity when all slots are full. An existing watch rebinding after credential reissue logs once and retries capacity with 1-to-5-second backoff for at most 60 seconds, then returns WatchCapacity if no slot became available. Terminal maintenance interrupts that wait with the same transport error as EventReader.
After reconnecting, delivers each key whose latest retained revision is newer than the last delivered revision, without repeating a revision. Intermediate values overwritten while disconnected are not delivered; readers needing every change must use an event stream, not a bucket. Delete markers remain the key’s latest entry and survive reconnects. Owners must use delete, never purge: removing a marker hides the deletion. Keep the BusClient alive; terminal renewal ends next() with Error::Transport, just as EventReader does.