-
Notifications
You must be signed in to change notification settings - Fork 586
Partition-to-segment rename (wave 2): re_uri
#12050
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
Conversation
|
Web viewer built successfully.
View image diff on kitdiff. Note: This comment is updated whenever you push a commit. |
| pub fn new(origin: Origin, dataset_id: re_tuid::Tuid, url: &url::Url) -> Result<Self, Error> { | ||
| let mut partition_id = None; | ||
| let mut segment_id = None; | ||
| let mut legacy_partition_id = None; | ||
| let mut time_range = None; | ||
|
|
||
| for (key, value) in url.query_pairs() { | ||
| match key.as_ref() { | ||
| // Accept legacy `partition_id` query parameter. | ||
| "partition_id" => { | ||
| partition_id = Some(value.to_string()); | ||
| legacy_partition_id = Some(value.to_string()); | ||
| } | ||
|
|
||
| "segment_id" => { | ||
| segment_id = Some(value.to_string()); | ||
| } | ||
| "time_range" => { | ||
| // `+` means whitespace in URLs. | ||
| // Ideally `+` should be encoded as `%2B`, but in case we missed that: | ||
| let value = value.replace(' ', ""); | ||
| time_range = Some(value.parse::<TimeSelection>()?); | ||
| } | ||
| _ => { | ||
| // We ignore unknown query keys that may be from urls from prior/newer versions. | ||
| } | ||
| } | ||
| } | ||
|
|
||
| let Some(partition_id) = partition_id else { | ||
| return Err(Error::MissingPartitionId); | ||
| let segment_id = match (segment_id, legacy_partition_id) { | ||
| (Some(s), None) | (None, Some(s)) => s, | ||
|
|
||
| (None, None) => { | ||
| return Err(Error::MissingSegmentId); | ||
| } | ||
|
|
||
| (Some(_), Some(_)) => { | ||
| return Err(Error::AmbiguousSegmentId); | ||
| } | ||
| }; | ||
|
|
||
| let mut fragment = Fragment::default(); | ||
| if let Some(string) = url.fragment() { | ||
| fragment = Fragment::parse_forgiving(string); | ||
| } | ||
|
|
||
| Ok(Self { | ||
| origin, | ||
| dataset_id, | ||
| partition_id, | ||
| segment_id, | ||
| time_range, | ||
| fragment, | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only business logic part of this pr
emilk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and simple
Related
What
In this PR, we focus on
re_uri:?partition_idThe rest of the diff is essentially dealing with consequences, with some minor adjacent renames.