zacharyvoase / django-castor Goto Github PK
View Code? Open in Web Editor NEWA content-addressable storage backend for Django.
License: The Unlicense
A content-addressable storage backend for Django.
License: The Unlicense
I like the looks of django-castor and consider using it in a project. However reading the caveats section of the README, I was wondering how difficult it would be to let django-castor have automatic reference counting? This would be my preferred solution to cleaning the storage.
I have been playing with the idea to implement two fields (names could be CastorFileField
and CastorImageField
) for the purpose, with a simple model as backing store for the counting, but I deemed this an inflexible solution because it would make it impossible to use castor for other fields that inherit from FileField
or ImageField
.
My next idea is to make django-castor store which models have saved files through the storage, and then make delete
count from the database with these model references. Since the penalty is only big at delete time(at save time there's no counting, only addition of model reference if no already exists), I find it a promising design. A setting could be used to enable/disable this behaviour. However I currently see no way to let the storage know the model at save time. Perhaps __init__
or get_available_name
could read it from it's caller?
This is all unfortunately out of my scope for now, and I'm therefore wondering how I can implement garbage collection. Thinking of it, being able to garbage collect a single file, would also make it possible to clean up upon deletion.
Does anyone have an idea how to achieve clean up without coding it manually to check each of your models using the django-castor storage?
Perhaps inspecting all models at __init__
time?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.