Server work group, new focus areas

+ 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 Rails Console Shortcuts, Tips, and 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"

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.

6 Likes

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.)

2 Likes

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

3 Likes

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

1 Like

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.

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 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

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.

5 Likes

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.

1 Like

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.

1 Like

I'd like to draw your attention to my SwiftNIO-based FoundationDB client — GitHub - kirilltitov/FDBSwift: FoundationDB client for Swift. 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:

2 Likes

thanks @kirilltitov, how about putting together a pitch?

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

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.

1 Like

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

2 Likes

I agree. If there is anyone out there that is looking to start on a pure-swift RabbitMQ Package, I would love to contribute.

4 Likes