Replies: 6 comments 5 replies
-
I think users of such a library should be free to use any HTTP server library (like hyper) as well as any async-runtime (like tokio). In fact it seems like hyper depends on tokio. I think the questions is whether there is much left after abstracting away the server-stuff and backend-stuff like SQLite. I think we should continue this discussion by drafting a few use-cases which would require mbtileserver-rs as library. I'll start:
|
Beta Was this translation helpful? Give feedback.
-
One reason against properly supporting mbtileserver-rs as a library is stability. If we advertise it as a library then we have to keep the API stable. That is maybe not something we want in an early state of the project. If we just expose an unstable API which should be used internally and by a small group of people, then we can just do it and see how it goes :) So for me the question is more whether we want to expose a stable API or not. |
Beta Was this translation helpful? Give feedback.
-
I like the idea of having a library and binary. The main use case I can think of is using the library in a more generic tile server application. Something like geoserver that uses I should mention that mbtiles specs mentions SQLite as the backend, so we don't have much flexibility there. As for API stability, we can check the current implementation against the required stuff in the specs, and if it meets all the criteria, we can call it stable. |
Beta Was this translation helpful? Give feedback.
-
@nyurik re: code structure, I've tried what you've proposed in another tool before, and it worked fine for my simple use case. As for naming, crates.io is fine with having a library and binary with the same name under the same package. |
Beta Was this translation helpful? Give feedback.
-
For reference, we tried to do something roughly similar in It sounds like that might be a little different than what you have in mind here; we used the Go std library route handlers to build our handlers as part of that move (instead of relying on routing from the top-level web framework), but didn't get at the full flexibility of letting applications define their own handlers or URL patterns. We had a request to support Overall, I think it is a good idea to separate out the runtime environment from the code required to provide responses at different routes. However, I'd offer the following suggestions in case it helps here:
|
Beta Was this translation helpful? Give feedback.
-
This has been an amazing discussion, thanks!!! I have started a more general discussion on how different coding efforts can be combined together with some common goals -- see maplibre/maplibre#30 , and it uses some of the ideas from this one. I think we should keep this discussion going for the technical aspects, and the other for the more fundamental goal-setting ideas. |
Beta Was this translation helpful? Give feedback.
-
Tile servers have different use cases. Solving it with "one app fits all" may not work for some users. I would like to refactor
mbtileserver-rs
into a reusable library plus one or more app. This way the simple cases are covered out of the box, while complex ones can use the library to build their own custom solutions.There are several ways to structure directories. For now we can just have one lib and one binary in the project:
This way some app can use
mbtileserve
lib with different cases:TBD:
Beta Was this translation helpful? Give feedback.
All reactions