Branch: Tag:

2013-09-26

2013-09-26 11:22:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

FSGC: Moved API to base_server/module.pike.

This adds registration of modules that register fsgcs.

Note that this API change is incompatible with the previous API.
This shouldn't be a problem, since nothing that uses the old API
should be out in the wild yet.

44:    int num_files;    int total_size;    +  string modid;    string root;    int max_age;    int max_files;
300:    }    }    -  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)
422:    }   }    - 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);