+
+__END__
+
+=encoding utf-8
+
+=head1 NAME
+
+Gruntmaster::Data - Gruntmaster 6000 Online Judge -- database interface and tools
+
+=head1 SYNOPSIS
+
+
+=head1 DESCRIPTION
+
+Gruntmaster::Data is the interface to the Gruntmaster 6000 database.
+
+All functions are exported by default.
+
+=over
+
+=item B<dbinit>(I<@args>)
+
+This function connects to the database. I<@args> are the arguments
+passed to the L<DBIx::Simple> constructor.
+
+=item B<purge>(I<$url_path>)
+
+Purges a relative URL from the Varnish Cache by sending PURGE
+$url_path requests to all hosts in the PURGE_HOSTS environment
+variable.
+
+=item B<db>
+
+Returns a L<DBIx::Simple> object for interacting with the database
+directly. Use this when no other function in this module is suitable.
+
+=item B<user_list>
+
+Returns an arrayref of the top 200 users.
+
+=item B<user_entry>(I<$id>)
+
+Returns a hashref describing the user I<$id>.
+
+=item B<problem_list>([I<%args>])
+
+Returns an arrayref of problems.
+
+Takes the following named arguments:
+
+=over
+
+=item owner
+
+Only show problems owned by this user
+
+=item contest
+
+Only show problems in this contest
+
+=item private
+
+If true, include private problems. Always true if contest is present.
+
+=item solution
+
+If true, include problem solutions
+
+=back
+
+=item B<problem_entry>(i<$id>, [I<$contest>])
+
+Returns a hashref describing the problem I<$id>. If $contest is
+present, contest start and stop times are included, and the solution
+is deleted.
+
+=item B<contest_list>
+
+Returns an arrayref of contests.
+
+=item B<contest_entry>(I<$id>)
+
+Returns a hashref describing the contest I<$id>.
+
+=item B<contest_has_problem>(I<$contest>, I<$problem>)
+
+Returns true if the contest I<$contest> includes the problem
+I<$problem>, false otherwise.
+
+=item B<job_list>([I<%args>])
+
+In scalar context, returns an arrayref of jobs. In list context,
+returns an arrayref of jobs and a hashref of information about pages.
+
+Takes the following named arguments:
+
+=over
+
+=item page
+
+Show this page of the job log. Defaults to 1.
+
+=item owner
+
+Only show jobs submitted by this user.
+
+=item contest
+
+Only show jobs submitted in this contest.
+
+=item problem
+
+Only show jobs submitted for this problem.
+
+=item result
+
+Only show jobs with this result (see the constants in
+L<Gruntmaster::Daemon::Constants>).
+
+=item private
+
+If true, include private jobs. Defaults to false.
+
+=back
+
+=item B<job_entry>(I<$id>)
+
+Returns a hashref describing the job I<$id>.
+
+=item B<create_job>(I<%args>)
+
+Insert a new job into the database. This function also updates the
+lastjob field for the job's owner.
+
+=item B<standings>(I<$ct>)
+
+Returns an arrayref of the standings of contest I<$ct>.
+
+=item B<update_status>
+
+Rebuilds the problem_status and contest_status tables.
+
+=item B<rerun_job>(I<$id>)
+
+Marks the job $id as pending and clears its results, so that it will
+be run again by the daemon.
+
+=item B<take_job>(I<$daemon>)
+
+Marks a random job as being run by I<$daemon>. Returns a hashref
+describing the job, or undef if no job was available.
+
+=item B<finish_job>(I<$job>, I<$private>, I<%results>)
+
+Updates the job $job with the results in %results. If $private is
+false, also updates the problem_status table.
+
+=item B<open_problem>(I<$contest>, I<$problem>, I<$owner>, I<$time>)
+
+Notes that I<$owner> has opened the problem I<$problem> of contest
+I<$contest> at time I<$time>. If the C<opens> table already contains
+this (I<$contest>, I<$problem>, I<$owner>) triplet, this function does
+nothing.
+
+=back
+
+=head1 AUTHOR
+
+Marius Gavrilescu E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014-2015 by Marius Gavrilescu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.20.1 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut