1# -*- indent-tabs-mode: nil; -*-
2# vim:ft=perl:et:sw=4
3# $Id$
4
5# Sympa - SYsteme de Multi-Postage Automatique
6#
7# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel
8# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
9# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
10# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
11# Copyright 2017 The Sympa Community. See the AUTHORS.md file at the top-level
12# directory of this distribution and at
13# <https://github.com/sympa-community/sympa.git>.
14#
15# This program is free software; you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation; either version 2 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program.  If not, see <http://www.gnu.org/licenses/>.
27
28package Sympa::Spool::Archive;
29
30use strict;
31use warnings;
32use English qw(-no_match_vars);
33
34use Conf;
35
36use base qw(Sympa::Spool);
37
38sub _directories {
39    return {
40        directory     => $Conf::Conf{'queueoutgoing'},
41        bad_directory => $Conf::Conf{'queueoutgoing'} . '/bad',
42    };
43}
44use constant _generator      => 'Sympa::Message';
45use constant _marshal_format => '%d.%f.%s@%s,%ld,%d';
46use constant _marshal_keys   => [qw(date TIME localpart domainpart PID RAND)];
47use constant _marshal_regexp =>
48    qr{\A(\d+)\.(\d+\.\d+)\.([^\s\@]*)\@([\w\.\-*]*),(\d+),(\d+)};
49
501;
51__END__
52
53=encoding utf-8
54
55=head1 NAME
56
57Sympa::Spool::Archive - Spool for messages waiting for archiving
58
59=head1 SYNOPSIS
60
61  use Sympa::Spool::Archive;
62  my $spool = Sympa::Spool::Archive->new;
63
64  $spool->store($message);
65
66  my ($message, $handle) = $spool->next;
67
68=head1 DESCRIPTION
69
70L<Sympa::Spool::Archive> implements the spool for messages waiting for
71archiving.
72
73=head2 Methods
74
75See also L<Sympa::Spool/"Public methods">.
76
77=over
78
79=item next ( )
80
81Order is controlled by delivery date, then by reception date.
82
83=back
84
85=head2 Context and metadata
86
87See also L<Sympa::Spool/"Marshaling and unmarshaling metadata">.
88
89This class particularly gives following metadata:
90
91=over
92
93=item {date}
94
95Unix time when the message would be delivered.
96
97=item {time}
98
99Unix time in floating point number when the message was stored.
100
101=back
102
103=head1 CONFIGURATION PARAMETERS
104
105Following site configuration parameters in sympa.conf will be referred.
106
107=over
108
109=item queueoutgoing
110
111Directory path of archive spool.
112
113Note:
114Named such by historical reason.
115
116=back
117
118=head1 SEE ALSO
119
120L<Sympa::Archive>, L<Sympa::Message>, L<Sympa::Spindle::ProcessArchive>,
121L<Sympa::Spool>.
122
123=head1 HISTORY
124
125L<Sympa::Spool::Archive> appeared on Sympa 6.2.
126
127=cut
128