org/sonews/storage/Storage.java
author cli
Wed, 12 Aug 2009 13:03:23 +0200
changeset 7 0b76e099eb96
parent 3 2fdc9cc89502
child 12 bb6990c0dd1a
permissions -rw-r--r--
PullFeeder sends an addition "MODE READER" to peers.
chris@3
     1
/*
chris@3
     2
 *   SONEWS News Server
chris@3
     3
 *   see AUTHORS for the list of contributors
chris@3
     4
 *
chris@3
     5
 *   This program is free software: you can redistribute it and/or modify
chris@3
     6
 *   it under the terms of the GNU General Public License as published by
chris@3
     7
 *   the Free Software Foundation, either version 3 of the License, or
chris@3
     8
 *   (at your option) any later version.
chris@3
     9
 *
chris@3
    10
 *   This program is distributed in the hope that it will be useful,
chris@3
    11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
chris@3
    12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
chris@3
    13
 *   GNU General Public License for more details.
chris@3
    14
 *
chris@3
    15
 *   You should have received a copy of the GNU General Public License
chris@3
    16
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
chris@3
    17
 */
chris@3
    18
chris@3
    19
package org.sonews.storage;
chris@3
    20
chris@3
    21
import java.util.List;
chris@3
    22
import javax.mail.internet.InternetAddress;
chris@3
    23
import org.sonews.feed.Subscription;
chris@3
    24
import org.sonews.util.Pair;
chris@3
    25
chris@3
    26
/**
chris@3
    27
 * A generic storage backend interface.
chris@3
    28
 * @author Christian Lins
chris@3
    29
 * @since sonews/1.0
chris@3
    30
 */
chris@3
    31
public interface Storage
chris@3
    32
{
chris@3
    33
chris@3
    34
  void addArticle(Article art)
chris@3
    35
    throws StorageBackendException;
chris@3
    36
chris@3
    37
  void addEvent(long timestamp, int type, long groupID)
chris@3
    38
    throws StorageBackendException;
chris@3
    39
chris@3
    40
  void addGroup(String groupname, int flags)
chris@3
    41
    throws StorageBackendException;
chris@3
    42
chris@3
    43
  int countArticles()
chris@3
    44
    throws StorageBackendException;
chris@3
    45
chris@3
    46
  int countGroups()
chris@3
    47
    throws StorageBackendException;
chris@3
    48
chris@3
    49
  void delete(String messageID)
chris@3
    50
    throws StorageBackendException;
chris@3
    51
chris@3
    52
  Article getArticle(String messageID)
chris@3
    53
    throws StorageBackendException;
chris@3
    54
chris@3
    55
  Article getArticle(long articleIndex, long groupID)
chris@3
    56
    throws StorageBackendException;
chris@3
    57
chris@3
    58
  List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
chris@3
    59
    throws StorageBackendException;
chris@3
    60
chris@3
    61
  List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
chris@3
    62
    String header, String pattern)
chris@3
    63
    throws StorageBackendException;
chris@3
    64
chris@3
    65
  long getArticleIndex(Article art, Group group)
chris@3
    66
    throws StorageBackendException;
chris@3
    67
chris@3
    68
  List<Long> getArticleNumbers(long groupID)
chris@3
    69
    throws StorageBackendException;
chris@3
    70
chris@3
    71
  String getConfigValue(String key)
chris@3
    72
    throws StorageBackendException;
chris@3
    73
chris@3
    74
  int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
chris@3
    75
    Channel channel)
chris@3
    76
    throws StorageBackendException;
chris@3
    77
chris@3
    78
  double getEventsPerHour(int key, long gid)
chris@3
    79
    throws StorageBackendException;
chris@3
    80
chris@3
    81
  int getFirstArticleNumber(Group group)
chris@3
    82
    throws StorageBackendException;
chris@3
    83
chris@3
    84
  Group getGroup(String name)
chris@3
    85
    throws StorageBackendException;
chris@3
    86
chris@3
    87
  List<Channel> getGroups()
chris@3
    88
    throws StorageBackendException;
chris@3
    89
chris@3
    90
  List<String> getGroupsForList(InternetAddress inetaddress)
chris@3
    91
    throws StorageBackendException;
chris@3
    92
chris@3
    93
  int getLastArticleNumber(Group group)
chris@3
    94
    throws StorageBackendException;
chris@3
    95
chris@3
    96
  String getListForGroup(String groupname)
chris@3
    97
    throws StorageBackendException;
chris@3
    98
chris@3
    99
  String getOldestArticle()
chris@3
   100
    throws StorageBackendException;
chris@3
   101
chris@3
   102
  int getPostingsCount(String groupname)
chris@3
   103
    throws StorageBackendException;
chris@3
   104
chris@3
   105
  List<Subscription> getSubscriptions(int type)
chris@3
   106
    throws StorageBackendException;
chris@3
   107
chris@3
   108
  boolean isArticleExisting(String messageID)
chris@3
   109
    throws StorageBackendException;
chris@3
   110
chris@3
   111
  boolean isGroupExisting(String groupname)
chris@3
   112
    throws StorageBackendException;
chris@3
   113
chris@3
   114
  void purgeGroup(Group group)
chris@3
   115
    throws StorageBackendException;
chris@3
   116
chris@3
   117
  void setConfigValue(String key, String value)
chris@3
   118
    throws StorageBackendException;
chris@3
   119
chris@3
   120
  boolean update(Group group)
chris@3
   121
    throws StorageBackendException;
chris@3
   122
chris@3
   123
}