-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
feat!: DashMap
based catalog
#1585
base: main
Are you sure you want to change the base?
Conversation
I'm really happy to see you pick this up again. It's a looooooong requested feature. And Martin needs more contributor. Go ahead! : D @CommanderStorm |
Consider making the use of |
No, splitting the implementation on one of the core datastructures is a great way to get bugs and maintainability issues.
|
60ns means nothing to me. I'm totally Ok the performance part. |
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.
great work!! Seriously impressive :)
A few things:
- could you explain a bit why you need boxed source? Can we work around it?
- please move the sorting output into a separate PR - this way test changes do not get in the way of the review
- this also goes for anything unrelated to this pr - switching to dashmap is a complex PR - so the fewer changes we have in it, the easier it is to spot issues
plus a few minor inlines
martin/src/bin/martin-cp.rs
Outdated
@@ -392,7 +392,7 @@ fn parse_encoding(encoding: &str) -> MartinCpResult<AcceptEncoding> { | |||
async fn init_schema( | |||
mbt: &Mbtiles, | |||
conn: &mut SqliteConnection, | |||
sources: &[&dyn Source], | |||
sources: &[Box<dyn Source>], |
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.
I'm still not certain why you need a boxed type here - what caused it to change? Also, you might want to use TileInfoSource
for consistency
martin/src/sprites/mod.rs
Outdated
@@ -198,18 +195,18 @@ async fn parse_sprite( | |||
} | |||
|
|||
pub async fn get_spritesheet( | |||
sources: impl Iterator<Item = &SpriteSource>, | |||
paths: impl Iterator<Item = &PathBuf>, |
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.
is this relevant to this PR? I am usually ok to mix in a bunch of unrelated changes into smaller / linter / cleanup PRs, but in case of a the complex PRs that already do a lot of fundamental system changes, it is better to move unrelated stuff to a separate PR
pub fn get_source(&self, id: &str) -> actix_web::Result<TileInfoSource> { | ||
Ok(self | ||
.0 | ||
.get(id) | ||
.ok_or_else(|| ErrorNotFound(format!("Source {id} does not exist")))? | ||
.as_ref()) | ||
.value() | ||
.clone()) | ||
} |
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 PR pulls the changes to `Box<dyn Source>` vs `TileInfoSource` from - #1585
f941c65
to
935f30c
Compare
This PR changes the internal datastructure to be
Dashmap<..>
as suggested in #1179 (review)I thought that the data/configuration/.. split might be more managble in terms of reviwing and shipping this.
Sadly two changes did cascade a bit:
&dyn Source
->Box<dyn Source>
DashMap
does not guarantee sorting of keys => I need to manually do soI had some free time and this seemed like a nice issue to progress on, I hope you (@sharkAndshark) don't mind me stealing this part ^^