-
Notifications
You must be signed in to change notification settings - Fork 7
A Web Luabrary #2
Comments
Excellent ideas. I've been stewing over similar things today. And I like the name "Luabrary" haha. To add to your list, there should also be a good way to produce and consume JSON and (eventually) other common serialization formats. As far as data persistence is concerned, this is an area where PHP is kind of weak and it would be nice if this Luabrary was a little more helpful. The session abstraction you talked about is probably essentially a key/value store except scoped to a particular user. (It would be nice, too, if sessions were implemented to automatically mitigate session hijacking.) What defines the lifetime of the app? Just however long Caddy is executing? Or do we dump to disk and if so, how often? Or maybe it can use an external data store like a database. (This is not a simple task! Lots of effort will be required here.) Go has some data stores that are pure-Go and in-process, which is really appealing. Maybe we could look into one of those. I'm gonna play around to see what it takes to do simple things like convenient access to the HTTP response and request, and if I like the result, I'll push it. |
I think a pure Go in-memory store might be really nice. I don't think this kind of storage would have to persist across a reboot, so in-memory should be good. For "lifetime of the app", I was thinking generally that would be however long Caddy is executing, though I figured we might at some point want to make it possible to restart a Lua app independently of a web server restart (like, say, for dev mode). I have been trying to refine my idea of a shared cache, and so far this is the best I've come up with:
Finally, I was thinking more about the possibility of using concurrency inside of Lua, and realized that if we allow that, we should make sure that things that we pass in are either read-only (like some of the request data) or are protected by a mutex. |
The name "Luabrary" made me chuckle. I like it and the list of features is a good start. Here are some more that may be useful:
There are two ways I've seen PHP used to build things for the web. One is as tags inside HTML and it makes local modifications. The other is as a full web programming language. Is the idea of Luabrary to handle both? |
FWIW, back in my PHP days, I did use persistent connections but it would be interesting to see how challenging those are to implement. It may totally be worth the effort. As far as page caching goes, I do intend for Caddy to get a cache middleware at some point that should be able to take care of caching pages (although dynamic pages are trickier to figure out). @mattfarina Glad you could join our discussion. 🎉 I hope that by Go 1.6, the http2 lib we're using will be able to handle server push (or have some hooks for it), but at this time I don't think it does. About the two ways to use PHP, I think this Lua engine can handle both. We can parse Lua out of HTML and it (through the use of |
So... Luabrary was originally a typo. I was trying to type Lua Library... but it looked cute, so I left it. Cookies are a great idea, and I think we can easily accommodate serving from object storage and other things. I think both @mholt and I have delved deeply into the Go HTTP2 library, and it's really not yet at the point where it can meaningfully handle the more advanced HTTP/2 stuff. If I recall correctly, we can get it to do data framing (the HTTP/2 version of chunking). So that one is a great idea to include. |
Is it possible to make use of this: http://leafo.net/lapis/ ? |
Do you plan to use LuaJIT ? I'm playing with the Lapis Lua framework lately and it's just very good ! |
If we were to provide a full web library for the Lua engine, what sorts of things would we include? Here are my thoughts:
<?lua...
)The text was updated successfully, but these errors were encountered: