10000 tsparser: fix bucket usage mapping by eandre · Pull Request #1592 · encoredev/encore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tsparser: fix bucket usage mapping #1592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
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
22 changes: 12 additions & 10 deletions tsparser/src/legacymeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,8 @@ impl<'a> MetaBuilder<'a> {

let idx = svc_index.get(&svc.name).unwrap();
bucket_perms
.entry(*idx)
.or_insert(v1::BucketUsage {
bucket: access.bucket.name.clone(),
operations: vec![],
})
.operations
.entry((*idx, &access.bucket.name))
.or_insert(vec![])
.extend(ops);
}

Expand Down Expand Up @@ -448,11 +444,14 @@ impl<'a> MetaBuilder<'a> {
}

// Add the computed bucket permissions to the services.
for (svc_idx, mut bucket_perm) in bucket_perms {
for ((svc_idx, bucket), mut operations) in bucket_perms {
// Make the bucket perms sorted and unique.
bucket_perm.operations.sort();
bucket_perm.operations.dedup();
self.data.svcs[svc_idx].buckets.push(bucket_perm);
operations.sort();
operations.dedup();
self.data.svcs[svc_idx].buckets.push(v1::BucketUsage {
bucket: bucket.clone(),
operations,
});
}

// Sort the packages for deterministic output.
Expand All @@ -469,6 +468,9 @@ impl<'a> MetaBuilder<'a> {
svc.databases.sort();
svc.databases.dedup();

// Sort buckets by name for deterministic output.
svc.buckets.sort_by(|a, b| a.bucket.cmp(&b.bucket));

// Sort the endpoints for deterministic output.
svc.rpcs.sort_by(|a, b| a.name.cmp(&b.name));
}
Expand Down
Loading
0