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 org.sonews.feed.Subscription;
|
chris@3
|
23 |
import org.sonews.util.Pair;
|
chris@3
|
24 |
|
chris@3
|
25 |
/**
|
chris@3
|
26 |
* A generic storage backend interface.
|
chris@3
|
27 |
* @author Christian Lins
|
chris@3
|
28 |
* @since sonews/1.0
|
chris@3
|
29 |
*/
|
chris@3
|
30 |
public interface Storage
|
chris@3
|
31 |
{
|
chris@3
|
32 |
|
cli@12
|
33 |
/**
|
cli@12
|
34 |
* Stores the given Article in the storage.
|
cli@12
|
35 |
* @param art
|
cli@12
|
36 |
* @throws StorageBackendException
|
cli@12
|
37 |
*/
|
chris@3
|
38 |
void addArticle(Article art)
|
chris@3
|
39 |
throws StorageBackendException;
|
chris@3
|
40 |
|
chris@3
|
41 |
void addEvent(long timestamp, int type, long groupID)
|
chris@3
|
42 |
throws StorageBackendException;
|
chris@3
|
43 |
|
chris@3
|
44 |
void addGroup(String groupname, int flags)
|
chris@3
|
45 |
throws StorageBackendException;
|
chris@3
|
46 |
|
chris@3
|
47 |
int countArticles()
|
chris@3
|
48 |
throws StorageBackendException;
|
chris@3
|
49 |
|
chris@3
|
50 |
int countGroups()
|
chris@3
|
51 |
throws StorageBackendException;
|
chris@3
|
52 |
|
chris@3
|
53 |
void delete(String messageID)
|
chris@3
|
54 |
throws StorageBackendException;
|
chris@3
|
55 |
|
chris@3
|
56 |
Article getArticle(String messageID)
|
chris@3
|
57 |
throws StorageBackendException;
|
chris@3
|
58 |
|
chris@3
|
59 |
Article getArticle(long articleIndex, long groupID)
|
chris@3
|
60 |
throws StorageBackendException;
|
chris@3
|
61 |
|
chris@3
|
62 |
List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last)
|
chris@3
|
63 |
throws StorageBackendException;
|
chris@3
|
64 |
|
chris@3
|
65 |
List<Pair<Long, String>> getArticleHeaders(Channel channel, long start, long end,
|
chris@3
|
66 |
String header, String pattern)
|
chris@3
|
67 |
throws StorageBackendException;
|
chris@3
|
68 |
|
chris@3
|
69 |
long getArticleIndex(Article art, Group group)
|
chris@3
|
70 |
throws StorageBackendException;
|
chris@3
|
71 |
|
chris@3
|
72 |
List<Long> getArticleNumbers(long groupID)
|
chris@3
|
73 |
throws StorageBackendException;
|
chris@3
|
74 |
|
chris@3
|
75 |
String getConfigValue(String key)
|
chris@3
|
76 |
throws StorageBackendException;
|
chris@3
|
77 |
|
chris@3
|
78 |
int getEventsCount(int eventType, long startTimestamp, long endTimestamp,
|
chris@3
|
79 |
Channel channel)
|
chris@3
|
80 |
throws StorageBackendException;
|
chris@3
|
81 |
|
chris@3
|
82 |
double getEventsPerHour(int key, long gid)
|
chris@3
|
83 |
throws StorageBackendException;
|
chris@3
|
84 |
|
chris@3
|
85 |
int getFirstArticleNumber(Group group)
|
chris@3
|
86 |
throws StorageBackendException;
|
chris@3
|
87 |
|
chris@3
|
88 |
Group getGroup(String name)
|
chris@3
|
89 |
throws StorageBackendException;
|
chris@3
|
90 |
|
chris@3
|
91 |
List<Channel> getGroups()
|
chris@3
|
92 |
throws StorageBackendException;
|
chris@3
|
93 |
|
cli@14
|
94 |
/**
|
cli@14
|
95 |
* Retrieves the collection of groupnames that are associated with the
|
cli@14
|
96 |
* given list address.
|
cli@14
|
97 |
* @param inetaddress
|
cli@14
|
98 |
* @return
|
cli@14
|
99 |
* @throws StorageBackendException
|
cli@14
|
100 |
*/
|
cli@14
|
101 |
List<String> getGroupsForList(String listAddress)
|
chris@3
|
102 |
throws StorageBackendException;
|
chris@3
|
103 |
|
chris@3
|
104 |
int getLastArticleNumber(Group group)
|
chris@3
|
105 |
throws StorageBackendException;
|
chris@3
|
106 |
|
cli@12
|
107 |
/**
|
cli@12
|
108 |
* Returns a list of email addresses that are related to the given
|
cli@12
|
109 |
* groupname. In most cases the list may contain only one entry.
|
cli@12
|
110 |
* @param groupname
|
cli@12
|
111 |
* @return
|
cli@12
|
112 |
* @throws StorageBackendException
|
cli@12
|
113 |
*/
|
cli@12
|
114 |
List<String> getListsForGroup(String groupname)
|
chris@3
|
115 |
throws StorageBackendException;
|
chris@3
|
116 |
|
chris@3
|
117 |
String getOldestArticle()
|
chris@3
|
118 |
throws StorageBackendException;
|
chris@3
|
119 |
|
chris@3
|
120 |
int getPostingsCount(String groupname)
|
chris@3
|
121 |
throws StorageBackendException;
|
chris@3
|
122 |
|
chris@3
|
123 |
List<Subscription> getSubscriptions(int type)
|
chris@3
|
124 |
throws StorageBackendException;
|
chris@3
|
125 |
|
chris@3
|
126 |
boolean isArticleExisting(String messageID)
|
chris@3
|
127 |
throws StorageBackendException;
|
chris@3
|
128 |
|
chris@3
|
129 |
boolean isGroupExisting(String groupname)
|
chris@3
|
130 |
throws StorageBackendException;
|
chris@3
|
131 |
|
chris@3
|
132 |
void purgeGroup(Group group)
|
chris@3
|
133 |
throws StorageBackendException;
|
chris@3
|
134 |
|
chris@3
|
135 |
void setConfigValue(String key, String value)
|
chris@3
|
136 |
throws StorageBackendException;
|
chris@3
|
137 |
|
cli@24
|
138 |
/**
|
cli@24
|
139 |
* Updates headers and channel references of the given article.
|
cli@24
|
140 |
* @param article
|
cli@24
|
141 |
* @return
|
cli@24
|
142 |
* @throws StorageBackendException
|
cli@24
|
143 |
*/
|
cli@24
|
144 |
boolean update(Article article)
|
cli@24
|
145 |
throws StorageBackendException;
|
cli@24
|
146 |
|
chris@3
|
147 |
boolean update(Group group)
|
chris@3
|
148 |
throws StorageBackendException;
|
chris@3
|
149 |
|
chris@3
|
150 |
}
|