Bundesamt für Sicherheit in der Informationstechnik > Dicop-Server-3.04 > Dicop::Data::Client

Download:
dicop/Dicop-Server-3.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1.04   Source  

NAME ^

Dicop::Data::Client - a client in the Dicop system.

SYNOPSIS ^

    use Dicop::Data::Client;

REQUIRES ^

perl5.005, Exporter, Dicop::Server, Dicop::Data, Math::Bigfloat

EXPORTS ^

Exports nothing on default.

DESCRIPTION ^

For a description of fields a client has, see doc/Objects.pod.

METHODS ^

architectures()

        my @archs = $client->architectures();

Returns the architectures the client belong to. {arch} can be something like "linux-i386" and a client with that belongs to 'linux-i386' and 'linux', so this would return a list of ('linux-i386', 'linux').

went_offline()

Returns 0 for no, and 1 for yes. Returns only one time 1, then returns 0 until the client goes offline again.

is_online()

Given a time in seconds, test whether client did a connect in that timeframe. If yes, return 0 (client is online) or 1 (client offline).

is_proxy()

Return true if the client is a proxy. False for normal clients.

lost_chunk

Client failed to report back for a chunk, so update his stats.

reset()

        $client->reset();

Reset the clients statistics, like job speed, average speed, and delete failure counters etc.

discard_job()

A job on the server is done/suspended/closed so the client can discard cached information (notebly the speed value). This is necc. to avoid huge cache growths.

adjust_speed()

        my $speed = $client->adjust_speed($size, $took, $jobid, $status);

Adjusts the speed factor of the job on this client, taking into account the size of the chunk (in keys), the time it took to complete (in seconds) and the status (failed or timeout?).

speed_factor()

Recalculate the average speed factor from the different job speeds.

count_failure()

Increment the failure counter for a given jobtype. If given increment is zero, the counter will be reset.

        $self->count_failure($jobtype,2);       # inc by 2
        $self->count_failure($jobtype,0);       # reset

failures()

Return number of failures (the so-called failure score) for a jobtype. For each FAILED chunk the score is raised by 1, and for each FAILED testcase the score is raised by 3. If this this score is greater than 2, the client will be denied work for this particular jobtype.

The counter will be reset when the client successfully finishes all testcases for that jobtype. This is forced after 6 hours by sending the client the appropriate testcases if the failure counter is too high. Alternatively a restart of the client will reset the counter, since the client will request and work on all testcases.

store_error()

        $client->store_error( $time, $error_text);

Given a time stamp and an error message, stores these two to display them on the GUI later.

punish()

        $client->punish($pain);

The client tried to report a chunk, but the result or checksum differed from what another client previously reported. So "punish" it for this. Trusted clients are imune to this, while untrusted ones get their "health" decreased, until they "die". "Dead" clients are no longer able to work in the cluster, which is the entire idea behind this punishment setup.

Clients that are trusted are know to be deliver always good results (barring hardware failures, which can be detected by known testcases), while untrusted clients are unknown for their quality. By punishing the untrusted ones and leaving the trusted ones alone, each untrusted client caught cheating will get punished and the result from it will be thrown away.

Idially, the first attempt to deliver a faulty result will also put the client into the suspicious group, which means it absolutely *must* verify the work with a trusted client and *must* succeed in doing so. Only then it is put back in the "untrusted" group.

job_speed()

Return a clients speed for a given job in keys/s. In case this is not defined, calculates the speed from it's onw average speed and the given default speed for the jobtype based on the following formula:

        $jobspeed = $client_speed * $jobtype_speed / 100;

report()

Client reported back work, so update his stats, recalculate speed value etc.

connected()

Client connected, update his stats.

rate_limit()

        return if $self->rate_limit();

Returns true if the client's rate limit was reached, meaning no more connects are allowed at the current time.

terminate()

        $client->terminate()

Flags the client, so that on next connect the client get's a terminate now signal, which causes the client to stop. If the client is started by a script running in an endless-loop, this script will download the newest client and retry. So this is effecitvely a forced client-uopdate.

BUGS ^

None known yet.

AUTHOR ^

(c) Bundesamt fuer Sicherheit in der Informationstechnik 1998-2006

DiCoP is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

See http://www.bsi.de/ for more information.