summaryrefslogtreecommitdiffstats
path: root/extensions/Push/lib/Constants.pm
blob: c021b32f40595f6fc783b975932a54de2533f8ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

package Bugzilla::Extension::Push::Constants;

use 5.10.1;
use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(
  PUSH_RESULT_OK
  PUSH_RESULT_IGNORED
  PUSH_RESULT_TRANSIENT
  PUSH_RESULT_ERROR
  PUSH_RESULT_UNKNOWN
  push_result_to_string

  POLL_INTERVAL_SECONDS
);

use constant PUSH_RESULT_OK        => 1;
use constant PUSH_RESULT_IGNORED   => 2;
use constant PUSH_RESULT_TRANSIENT => 3;
use constant PUSH_RESULT_ERROR     => 4;
use constant PUSH_RESULT_UNKNOWN   => 5;

sub push_result_to_string {
  my ($result) = @_;
  return 'OK'              if $result == PUSH_RESULT_OK;
  return 'OK-IGNORED'      if $result == PUSH_RESULT_IGNORED;
  return 'TRANSIENT-ERROR' if $result == PUSH_RESULT_TRANSIENT;
  return 'FATAL-ERROR'     if $result == PUSH_RESULT_ERROR;
  return 'UNKNOWN'         if $result == PUSH_RESULT_UNKNOWN;
}

use constant POLL_INTERVAL_SECONDS => 30;

1;