+ 4
How can store media files in database?
Actually I want to set up my own cloud over LAN, I wonder how to implement it.. I don't want to go for OwnCloud or any other IaaS based software as I want to write my own cloud controller...
6 Réponses
+ 4
visph Typically, I would agree with the answer in that link. However, that answer predates GridFS in MongDB, which has been an incredible solution for our needs.
The biggest challenge for us using file paths was file locks that would not be released by the service or OS handlers. These would happen intermittently and require a service restart or sometimes server reboot. This would typically occur during some rare race condition between asynchronous processes that ultimately result in a thread lock due to attempts to access shared IO resources that inherently lack fundamental safeguards like being thread safe or transactional.
+ 4
MongoDB has an amazing feature called GridFS. It's like having your own portable AWS S3 buckets.
We've been using it for years in an enterprise application we developed for building media rich course packages.
Read / write access is fast and stable. It also eliminated issues with file locks over network file shares.
+ 3
Rather than storing your binary data in your database, it would be more advised and more efficient (depending on your files sizes and count context, and so on...) to store references (ie: path) to files in your server file system ^^
https://softwareengineering.stackexchange.com/a/150787
+ 3
I just completed my Implementation here 😁,
I have set up my flask server on my raspberry pi connected to my hard disk, wrote a python code for isolated space for each user and storage allocated. Basic idea I used is The username is actually a folder in file system where user upload and downlad files over lan connection.. (few features of os in python)
And issue that David Carroll mention about file lock, I handled that by creating a copy of that file as user shares with someone in his folder, (but changes in one doesn't change the other, no idea how to do that... working on it)
+ 3
Martin Taylor , Your idea is not bad, I thought about that to store them as blob, but then that will be like a database.. not a cloud. I was looking for something like cloud (but on single pc)
+ 2
David Carroll you're right: I've only provided a quick search link for suggesting to OP (and any reader interested by this topic ;)) that's important to have an overview of pros and cons and ask themselve wich are the better suited options for their context: obviously, that's a bad idea to limit research on the first opinion encountered ^^
So, thanks for your contribution: if that doesn't really matter for private project (where there's only one user on a LAN), it will become less or more critical in multi-user (or single-user working on many sessions at once)... Anyway, since main purpose is only to read cloud data, and not to write cloud data (even more update cloud data), conflicts due to lacks of file locks would have few probabilities (if any) to occur, isn't it?