[Ur] callbacks from the c ffi

Adam Chlipala adamc at csail.mit.edu
Sun Sep 30 14:46:03 EDT 2012


On 09/29/2012 06:08 PM, Greg Samsa wrote:
> Thank you for the replies!  I am looking at Ur to help me manage files (image, video and so on).
>    

One weakness of the current Ur/Web implementation is that there is a 
primitive type of files, but it requires all file data to be loaded into 
main memory, to take any action based on that file.  It might be worth 
creating a library for filesystem-based file management, presented 
nicely behind an abstract type of handles that are legal to store in 
databases.  Or it might even be worth making some changes to the 
standard library/runtime system.

If your files are small enough, they are quite easy to store in the SQL 
database.  The only objections there would be about performance.

> I'd like to be able to use FUSE to make file uploads easier for myself (while Ur would handle file metadata from a standard db/web app), and considered having the Ur code tightly integrated with the FUSE API (which is callback based - http://fuse.sourceforge.net/doxygen/structfuse__operations.html).  Hopefully this very high level description makes sense.
>    

So you're talking about a database (and here I don't mean to imply that 
it's an SQL database, just a persistent data store of some kind) 
accessed via multiple different protocols, one of which is an Ur/Web 
app.  I can imagine C FFI code being written to interface with several 
reasonable takes on this idea.

> I think for now I can accomplished my goals by having the FUSE code be a separate daemon that simply makes http calls from the FUSE layer into the Ur app. This is probably a cleaner and more robust solution, but I can't help thinking (perhaps irrationally) that it would be a killer feature for Ur generated C functions to be embeddable into other applications languages :)
>    

It probably wouldn't be too hard to change compilation to C, such that 
function types are allowed in code, to be used to reference C-style 
function pointers, not closures.  However, from your description of your 
application, it is not at all clear to me why it would be such a big 
advantage to call Ur functions from C.  I expect it will certainly be 
simplest to get your FUSE code to call the Ur/Web app, as you suggest; 
and another reasonable-seeming option is to write independent FUSE and 
Ur/Web implementations of access to a common database.  Just the data 
model and access approach can't be _too_ complex, right?



More information about the Ur mailing list