MongooseWhere programmers kick back and build silly things together.

All help topics · Link to this topic

Showing help on '$quota_utils'

byte quota utilities ($quota_utils #79)

Verbs a user might want to call from a program:
:bi_create -- built-in create() call, takes same args.

:get_quota(who) -- just get the raw size_quota property
:display_quota(who) -- prints to player the quota of who. If caller_perms() controls who, include any secondary characters. Called by @quota.
:get_size_quota(who [allchars]) -- return the quota of who, if allchars flag set, add info from all secondary chars, if caller_perms() permits.

:value_bytes(value) -- computes the size of the value.
:object_bytes(object) -- computes the size of the object and caches it.
:recent_object_bytes(object, days) -- computes and caches the size of object only if cached value more than days old. Returns cached value.
:do_summary(user) -- prints out the results of summarize-one-user.
:summarize_one_user(user) -- summarizes and caches space usage for user. See verb help for details.

Verbs the system calls:
:"creation_permitted verb_addition_permitted property_addition_permitted"(who) -- returns true if who is permitted to build.
:initialize_quota(who) -- sets quota for newly created players
:adjust_quota_for_programmer(who) -- empty; might add more quota to newly @progged player.
:enable_create(who) -- sets .ownership_quota to 1
:disable_create(who) -- sets .ownership_quota back to -1000 to prohibit create()
:charge_quota(who, object) -- subtract the size of object from who's quota. Manipulates the #-unmeasured if what is not currently measured. Called by $wiz_utils:set_owner.
:reimburse_quota(who, object) -- add the size of object to who's quota. Ditto.
:preliminary_reimburse_quota(who, object) -- Because the set_owner is done *after* an object has been turned into $garbage, ordinary reimbursement fails. So we use this verb in the $recycler.
:set_quota(who, howmuch)
:quota_remaining(who)
:display_quota_summary -- internal, called by display quota

The measurement task:

:measurement_task() -- runs once every 24 hours measuring stuff, separated from the scheduling in case you just want to run it once. Calls the body and then reports via moomail.
:schedule_measurement_task() -- actually schedules it. Look here to change the start time.
:measurement_task_body(timeout) -- does the real work, working for no longer than timeout seconds.
.task_time_limit -- integer number of seconds indicating for how long it should run each day.
.working -- object indicating the player whom it is either working on now (or if not running) will pick up working on when it commences tonight.
.cycle_days -- integer numbers indicating how long ago an object must have been measured before it will be remeasured.
.repeat_cycle -- boolean. 0 means have a vanilla cycle (goes through all players() exactly once measuring their objects measured more than .cycle_days ago). 1 means to have a much more complex algorithm: The first cycle, it only measures stuff owned by people who have logged in within .cycle_days. If, in .task_time_limit seconds, it measures all objects not measured in cycle_days owned by such people, it will run again measuring those objects which have not been measured in cycle_days - 1, considering people who have logged in within 4 * cycle_days, repeating until it has used up its seconds. ("Doing some of tomorrow's work.") Selecting .repeat_cycle = 1 is appropriate only for large MOOs.
.exempted -- list of objects to never measure (useful if there are huge objects). Suggested huge objects include $player_db and $site_db.
.measurement_task -- indicates the task_id() of the most recent measurement task -- used to prevent duplicate invocation.
.report_recipients -- recipients of the daily reports. Set to {} to disable reporting entirely.

See help @measure and help @quota for the command line verbs.


Porter's notes: If you are planning on porting this system to another MOO, here are the things to grab in addition to @dumping all of $quota_utils:

The following verbs have been changed on $prog:
@prop*erty @verb @copy (@add-alias @copy-move as well)

The following verbs have been changed on $wiz:
@programmer @quota

The following verbs have been changed on $wiz_utils:
set_programmer set_owner make_player

The following verbs have been changed on $builder:
@quota _create

This verb probably should have gone on $builder.
@measure

The followig verbs have been changed on $recycler
_recycle _create setup_toad

The following verb has been changed on $login:
create

And don't forget $object_quota_utils, which has the object based implementation.

:parse_create_args - This figures out who is gonna own the stuff @create does.
:creation_permitted - quota sucks, return one no matter what
:charge_quota - Charge args[1] for the quota required to own args[2]
:reimburse_quota - reimburse args[1] for the quota required to own args[2]
:set_quota - Set args[1]'s quota to args[2]
:get_size_quota - Return args[1]'s quotas.
:quota_remaining - This wants to only be called by a wizard cuz I'm lazy.
:preliminary_reimburse_quota - This does the reimbursement work of the recycler, since we ignore $garbage in ordinary reimbursement.
:object_bytes - No need for lengthy algorithms to measure an object, we have a builtin now.
:summarize_one_user - Summarizes total space usage by one user (args[1]).
:recent_object_bytes(x, n) -- return object size of x, guaranteed to be no more than n days old. N defaults to this.cycle_days.
:add_owned_object(who, what) -- adds what to whose .owned_objects.
:measurement_task_nofork - This is a one-shot run of the measurement task, as opposed to :measurement_task, which will fork once per day.
:task_perms - Put all your wizards in $byte_quota_utils.wizards.

Also from $generic_utils: 1 documented verb. help $generic_utils