-
Notifications
You must be signed in to change notification settings - Fork 864
[WIP] Foxx Of The Future #1612
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
[WIP] Foxx Of The Future #1612
Conversation
Any chance we can have the old Foxx framework coexist with new framework, perhaps by using a different namespace? Not forever, just for a release. Using ArangoDB in production, I dislike the idea of deploying a new major version of the DBMS and also of my Foxx app at the same time. I'd rather first upgrade to ArangoDB 3, and only when it's been running stable for a few days upgrade my Foxx app. |
@pekeler We're looking into codemods using Facebook's jscodeshift as an option to make the conversion of "classic" Foxx apps to ArangoDB 3.0 services easier but can't promise anything at the present time. We will try to make the migration as easy as possible. |
My concern is more about the duration of downtime and risk mitigation when upgrading production, which is why I'd prefer to upgrade the DB and my Foxx app in two separate steps. Any assistance in converting my code is appreciated but not as much of a concern to me. |
@pekeler You mean having ArangoDB 2.8 Foxx apps work with no modifications at all on ArangoDB 3.0? I think we might be able to implement a compatibility layer and switch based on the "engines" field in the manifest (i.e. if arangodb is present and set to a version lower than 3, try to wrap it in the compatibility layer) but I'll need to look deeper into this. |
Yes. |
a91641f
to
5f4b475
Compare
@pekeler Okay, the plan is that we'll make it possible to run ArangoDB 2.8 services in ArangoDB 3.0. In order to do this without hauling around a lot of baggage we'll backport a few changes to 2.8 (which itself aims to be backwards compatible with 2.7, 2.6 and 2.5 within reason). This means the upgrade path looks as follows:
Because 2.8 will support the necessary changes to make legacy services work in 3.0 this allows using 2.8 as a stop gap and upgrading to 3.0 by letting the 2.8 services run in compatibility mode before upgrading them to 3.0 proper. |
Great 👍 Thank you! |
c27fc15
to
b6f3c94
Compare
✨ 🎉 ✨ |
@pluma to continue on #1612 (comment) foxx example could be: var eventsource = null;
// init event source
controller.get('/eventsource', {end:false}, (req, res) => {
eventsource = res;
res.setHeader('content-type', 'text/event-stream');
});
controller.get('/streamresult', (req, res) => {
res.end();
var it = db.query('for user in users return user');
var p = undefined;
while(p = it.next() ) {
eventsource.wirte('event: user');
eventsource.write(JSON.stringify(p);
} // while
}); We only need to control if the response is auto ended and to set headers. |
@baslr the API changes are currently "cosmetic", i.e. because the underlying internals of ArangoDB's request cycle haven't changed it's still not possible to send responses incrementally. We currently do not have support for EventSource/SSE. Also, the code example you're proposing would not work because there's no guarantee the requests to We're looking into several possible implementations of realtime streams at the moment but I do not think they will be available in the 3.0 release. If you want to discuss streams further (and make a case for eventsource vs websockets, for example), feel free to follow issue #602. |
This PR tracks the development of the Foxx rewrite for ArangoDB 3.0:
applicationContext
->module.context
manifest.json#controllers/exports
->manifest.json#main
manifest.json#files#type
for hardcoded mime types (see Manually set mime types #1702)arangodb.guessContentType
withmime-types
everywheremanifest.json#setup/teardown
add(3.x)manifest.json#provides
handle(3.x)manifest.json#provides
formanifest.json#dependencies
in Aardvark & Foxx CLIcreateRouter
Router#get/post/put/patch/delete
Router#all
Router#use
FoxxContext#use
Tree
Tree#resolve
Tree#dispatch
Treer#buildSwaggerPaths
FoxxService
FoxxContext#reverse
Foxx.Repository
into legacyFoxx.Model
into legacyFoxx.Controller
into legacyrefactor implementations(3.x)Wishlist: