Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
245d9af
Start adding support for sync streams
simolus3 Jun 19, 2025
65bdf1b
Add protocol changes
simolus3 Jul 1, 2025
73e15ce
Use serde_with
simolus3 Jul 1, 2025
90bcbab
Start with subscription logic
simolus3 Jul 2, 2025
5967d89
Start tracking subscriptions
simolus3 Jul 3, 2025
ae9ea85
Track subscriptions
simolus3 Jul 4, 2025
9ac34ae
Test handling default streams
simolus3 Jul 9, 2025
a0267c4
Update last_synced_at for subscriptions
simolus3 Jul 9, 2025
91eaa6d
Allow subscribing to streams
simolus3 Jul 10, 2025
6bf0bca
Expire subscriptions after TTL
simolus3 Jul 14, 2025
ff219d5
Support unsubscribing
simolus3 Jul 14, 2025
d39e201
Delete outdated subscriptions
simolus3 Jul 14, 2025
3129e4e
Include default ttl
simolus3 Jul 14, 2025
5ce30ca
New protocol format
simolus3 Jul 15, 2025
0f487d5
Fix tests
simolus3 Jul 22, 2025
9652865
More stream management tests
simolus3 Jul 22, 2025
950f448
Remove immediate parameter when unsubscribing
simolus3 Jul 22, 2025
9751005
Increase expires_at only when subscribing again
simolus3 Jul 22, 2025
db83d17
Implement new protocol format
simolus3 Aug 7, 2025
4644a82
Report errors
simolus3 Aug 7, 2025
97d447f
Update TTL behavior
simolus3 Aug 12, 2025
2c803e3
Refresh on keepalive
simolus3 Aug 12, 2025
b947528
Instruction to update expiry
simolus3 Aug 13, 2025
3016ddc
Add correct offline state
simolus3 Aug 13, 2025
e7453b5
Add offline sync state helper function
simolus3 Aug 13, 2025
a42845a
Simplify error reporting
simolus3 Aug 13, 2025
a136226
Improve comment
simolus3 Aug 13, 2025
23481d8
Use set for associated buckets
simolus3 Aug 18, 2025
c42169f
Compute progress in core extension
simolus3 Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use set for associated buckets
  • Loading branch information
simolus3 committed Aug 19, 2025
commit 23481d811dba0fc1213ccfc9bc229bca93ab0ee7
25 changes: 11 additions & 14 deletions crates/core/src/sync/sync_status.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
use alloc::{boxed::Box, collections::btree_map::BTreeMap, rc::Rc, string::String, vec::Vec};
use alloc::{
boxed::Box,
collections::{btree_map::BTreeMap, btree_set::BTreeSet},
rc::Rc,
string::String,
vec::Vec,
};
use core::{
cell::RefCell,
cmp::min,
Expand Down Expand Up @@ -276,7 +282,7 @@ pub struct ActiveStreamSubscription {
pub id: i64,
pub name: String,
pub parameters: Option<Box<JsonString>>,
pub associated_buckets: Vec<String>,
pub associated_buckets: BTreeSet<String>,
pub priority: Option<BucketPriority>,
pub active: bool,
pub is_default: bool,
Expand All @@ -293,7 +299,7 @@ impl ActiveStreamSubscription {
parameters: local.local_params.clone(),
is_default: local.is_default,
priority: None,
associated_buckets: Vec::new(),
associated_buckets: BTreeSet::new(),
active: local.active,

has_explicit_subscription: local.has_subscribed_manually(),
Expand All @@ -303,17 +309,8 @@ impl ActiveStreamSubscription {
}

pub fn mark_associated_with_bucket(&mut self, bucket: &OwnedBucketChecksum) {
match self.associated_buckets.binary_search(&bucket.bucket) {
Ok(_) => {
// The bucket is already part of the list
return;
}
Err(position) => {
// Insert here to keep vec sorted
self.associated_buckets
.insert(position, bucket.bucket.clone());
}
};
self.associated_buckets
.get_or_insert_with(&bucket.bucket, |key| key.clone());

self.priority = Some(match self.priority {
None => bucket.priority,
Expand Down
Loading