Roxen.git / server / base_server / fsgc.pike

version» Context lines:

Roxen.git/server/base_server/fsgc.pike:37:    */      //! Filesystem garbage collector for a single root directory.   class FSGarb   {    inherit Filesystem.Monitor.basic : basic;       int num_files;    int total_size;    +  string modid;    string root;    int max_age;    int max_files;    int max_size;       mapping(string:object) handle_lookup = ([]);    ADT.Priority_queue pending_gc = ADT.Priority_queue();      #ifdef FSGC_PRETEND    protected int rm(string path)
Roxen.git/server/base_server/fsgc.pike:293:    num_files--;    total_size -= old_st->size;       remove_pending(this);       check_threshold();    }    }    }    -  protected void create(string path, int max_age, +  protected void create(string modid, string path, int max_age,    int|void max_size, int|void max_files)    {    GC_WERR("FSGC: Max age: %d\n", max_age);    GC_WERR("FSGC: Max size: %d\n", max_size);    GC_WERR("FSGC: Max files: %d\n", max_files);    -  +  this_program::modid = modid; +     this_program::max_age = max_age;    this_program::max_size = max_size;    this_program::max_files = max_files;    -  +  root = canonic_path(path); +     ::create(max_age/file_interval_factor, 0, max_age);    -  root = path; -  -  monitor(path, 3); +  monitor(root, 3);    }       void stable_data_change(string path, Stdio.Stat st)    {    GC_WERR("FSGC: Deleting stale file: %O\n", path);    if (path == root) return;    rm(path);    }       void reconfigure(int new_max_age, int|void new_max_size,
Roxen.git/server/base_server/fsgc.pike:415:    return sprintf("FSGarbWrapper(%O)", id);    }       void reconfigure(int max_age, int|void max_size, int|void max_files)    {    FSGarb g = fsgarbs[id];    if (g) g->reconfigure(max_age, max_size, max_files);    }   }    - FSGarbWrapper register_fsgarb(string path, int max_age, + FSGarbWrapper register_fsgarb(string modid, string path, int max_age,    int|void max_size, int|void max_files)   { -  string id = path + "\0" + gethrtime(); -  FSGarb g = FSGarb(path, max_age, max_size, max_files); +  string id = modid + "\0" + path + "\0" + gethrtime(); +  FSGarb g = FSGarb(modid, path, max_age, max_size, max_files);    fsgarbs[id] = g;    GC_WERR("FSGC: Register garb on %O ==> id: %O\n", path, id);    return FSGarbWrapper(id);   }      void name_thread(object thread, string name);      protected void start_fsgarb()   {    meta_fsgc_thread = Thread.Thread(meta_fsgc);