Giter Club home page Giter Club logo

django-castor's People

Contributors

jezdez avatar justquick avatar zacharyvoase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-castor's Issues

How to implement reference counting or garbage collection

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.