Server work group, new focus areas


#41

+ 1 for hot code reloading. Don't know if it's possible, but that would be phenomenal given that development cycle speed is a pain point for compiled languages

Another point of interest along the same lines would be something like Ruby's Rails Console https://pragmaticstudio.com/tutorials/rails-console-shortcuts-tips-tricks

For those who are unfamiliar, it gives the user access to variables and methods within a running server along with a few other features, so you can do things like test methods, run synchronous ORM queries, and hit routes and receive results. For example:

>> movie = Movie.first // retrieve the first entry in the Movie table
>> movie.title // access fields
=> "Iron Man"
>> movie.rating
=> "PG-13"
>> movie.director
=> "Jon Favreau"

(Jim Dovey) #42

I've begun looking at implementing swift clients for services like Zookeeper and Kafka, and implementing codecs such as Avro. These are really just beginning to germinate at the moment while I concentrate mostly on swift-nio-http2, but my overall aim is to make it easy for services written in Swift to talk to other members of the data center and coordinate properly.

Right now I've got to the point where I've modified the Jute compiler in Zookeeper to spit out Swift implementations of the generated types, and I'm wondering whether that's something work exploring on its own. It's officially part of the Hadoop pipeline I believe, so whether it's worth looking there for a starting point that would then make it easier to build Swift into other Apache projects.


(Michael Bates) #43

Rails dev here! :wave:

To be more precise, rails console doesn't give you access to the running rails server. Rather, it gives you a REPL with some packages (gems, like ActiveRecord) imported automatically, plus a database connection, a logger, etc. Basically it bootstraps everything the server would need, but instead yields to the REPL.

I believe most of this could be accomplished by simply importing your application module and running a bootstrap function, which would no doubt depend on the framework you were using (or not using).

Swift already has a great REPL, but as far as I can remember, getting access to SPM packages from the REPL is still pretty tedious. I think it would be a huge boon for SPM to provide some conveniences around that. (This may have changed since I looked at it last) Furthermore, being able to start a REPL with a function call would :+1::+1: (à la the Python debugger, Javascript's debugger, etc.)


(Ankit Aggarwal) #44

This is not done yet (SR-1573). It would be great if someone from the community wants to work on implementing this.


#45

Thanks for clarifying :) I've got very limited rails experience so it's good to have someone else to fill in the gaps


(Michael Bates) #46

That's great! Yes, I agree. Especially since it's a two year old ticket :broken_heart:
I'll see what I can do about that.


(Maxim Veksler) #47

I want to add another thing that would be good to have, and having it in Swift #first would be setting a good path.

w3c has recently profiled the concept of Server Timing, i.e. standardised way by which server can report request timing to the client. You can think of it as a low level APM approach.

Here is the spec https://www.w3.org/TR/server-timing/

And here is an example of how it might look:

EXAMPLE 1
> GET /resource HTTP/1.1
> Host: example.com

< HTTP/1.1 200 OK
< Server-Timing: miss, db;dur=53, app;dur=47.2
< Server-Timing: customView, dc;desc=atl
< Server-Timing: cache;desc="Cache Read";dur=23.2
< Trailer: Server-Timing
< (... snip response body ...)
< Server-Timing: total;dur=123.4

(Pedro José Pereira Vieito) #48

I would like to add a new type to the list: an CLI argument parser library. Currently there are two popular argument parser libraries in the Swift ecosystem:

Both of them are very opinionated or do not include all the basic options required by a general purpose argument parser library (for example, CommandLine does not include positional arguments; Commander requires you to embed the main code into a completion). Also, CommandLine is no longer maintained and has been archived.

I think Swift should have a common and well-maintained general purpose argument parser library similar to argparse in Python.


(Jacob Williams) #49

There is another called Guaka which I am a bit of a fan of. I’m writing from mobile so i won’t go into much detail about it, but when I was searching for CLI parsers in swift I tried out Commander, CommandLine, and Guaka and I liked Guaka the best.


(Tanner) #50

There's also Vapor's console / command package Console.

https://docs.vapor.codes/3.0/console/overview/

That's what we use for Vapor's CLI tool Vapor Toolbox and also in Vapor itself for things like booting the HTTP server or running database migrations.


pinned #51

(Kirill Titov) #53

I'd like to draw your attention to my SwiftNIO-based FoundationDB client — https://github.com/kirilltitov/FDBSwift. I'm aware of the official client, but it doesn't seem to be updated so often (unlike mine). Additionally, I actively use my implementation in real business tasks, so it might become officially stable in nearest future. A little bit of rivalry is always good :slight_smile:


#54

thanks @kirilltitov, how about putting together a pitch?


(Kirill Titov) #55

I'm not sure, honestly. I'm afraid the pitch would result in a discussion hell.


(Mr Bee) #56

May I also request for FIrebird SQL, please? It's quite popular among Pascal (such as Free Pascal and Delphi) developers all around the world. I've been using it on many platforms for quite a long time and I found it as a very excellent RDBMS.

Thank you.


(Kyle Browning) #57

It's not that bad. I just did it.You get to propose the initial scope of everything, and yeah its discussion oriented but it's not bad