3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package org.sonews.storage;
21 import java.util.List;
22 import javax.mail.internet.InternetAddress;
23 import org.sonews.feed.Subscription;
24 import org.sonews.util.Pair;
27 * A generic storage backend interface.
28 * @author Christian Lins
31 public interface Storage
34 void addArticle(Article art)
35 throws StorageBackendException;
37 void addEvent(long timestamp, int type, long groupID)
38 throws StorageBackendException;
40 void addGroup(String groupname, int flags)
41 throws StorageBackendException;
44 throws StorageBackendException;
47 throws StorageBackendException;
49 void delete(String messageID)
50 throws StorageBackendException;
52 Article getArticle(String messageID)
53 throws StorageBackendException;
55 Article getArticle(long articleIndex, long groupID)
56 throws StorageBackendException;
58 List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
59 throws StorageBackendException;
61 List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
62 String header, String pattern)
63 throws StorageBackendException;
65 long getArticleIndex(Article art, Group group)
66 throws StorageBackendException;
68 List<Long> getArticleNumbers(long groupID)
69 throws StorageBackendException;
71 String getConfigValue(String key)
72 throws StorageBackendException;
74 int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
76 throws StorageBackendException;
78 double getEventsPerHour(int key, long gid)
79 throws StorageBackendException;
81 int getFirstArticleNumber(Group group)
82 throws StorageBackendException;
84 Group getGroup(String name)
85 throws StorageBackendException;
87 List<Channel> getGroups()
88 throws StorageBackendException;
90 List<String> getGroupsForList(InternetAddress inetaddress)
91 throws StorageBackendException;
93 int getLastArticleNumber(Group group)
94 throws StorageBackendException;
96 String getListForGroup(String groupname)
97 throws StorageBackendException;
99 String getOldestArticle()
100 throws StorageBackendException;
102 int getPostingsCount(String groupname)
103 throws StorageBackendException;
105 List<Subscription> getSubscriptions(int type)
106 throws StorageBackendException;
108 boolean isArticleExisting(String messageID)
109 throws StorageBackendException;
111 boolean isGroupExisting(String groupname)
112 throws StorageBackendException;
114 void purgeGroup(Group group)
115 throws StorageBackendException;
117 void setConfigValue(String key, String value)
118 throws StorageBackendException;
120 boolean update(Group group)
121 throws StorageBackendException;