1LIBSTORAGE(3)              Library Functions Manual              LIBSTORAGE(3)
2
3
4

NAME

6       libstorage - InterNetNews Storage API library routines
7

SYNOPSIS

9       #include "storage.h"
10
11       bool IsToken(const char *text);
12
13       char *TokenToText(const TOKEN token);
14
15       TOKEN TextToToken(const char *text);
16
17       bool SMsetup(SMSETUP type, void *value);
18
19       bool SMinit(void);
20
21       TOKEN SMstore(const ARTHANDLE article);
22
23       ARTHANDLE *SMretrieve(const TOKEN token, const RETRTYPE amount);
24
25       ARTHANDLE *SMnext(const ARTHANDLE *article, const RETRTYPE amount);
26
27       void SMfreearticle(ARTHANDLE *article);
28
29       bool SMcancel(TOKEN token);
30
31       bool SMprobe(PROBETYPE type, TOKEN *token, void *value);
32
33       void SMprintfiles(FILE *file, TOKEN token, char **xref, int ngroups)
34
35       bool SMflushcacheddata(FLUSHTYPE type);
36
37       void SMshutdown(void);
38
39       int SMerrno;
40       char *SMerrorstr;
41
42       #include "ov.h"
43
44       bool OVopen(int mode);
45
46       bool OVctl(OVCTLTYPE type, void *val);
47
48       bool OVgroupstats(char *group, int *lo, int *hi, int *count, int *flag);
49
50       bool OVgroupadd(char *group, ARTNUM lo, ARTNUM hi, char *flag);
51
52       bool OVgroupdel(char *group);
53
54       OVADDRESULT OVadd(TOKEN token, char *data, int len, time_t arrived);
55
56       bool OVcancel(TOKEN token);
57
58       void *OVopensearch(char *group, int low, int high);
59
60       bool OVsearch(void *handle, ARTNUM *artnum, char **data, int *len, TOKEN *token, time_t *arrived);
61
62       void OVclosesearch(void *handle);
63
64       bool OVgetartinfo(char *group, ARTNUM artnum, char **data, int *len, TOKEN *token);
65
66       bool OVexpiregroup(char *group, int *lo);
67
68       typedef struct _OVGE {
69           bool        delayrm;
70           bool        usepost;
71           bool        quiet;
72           bool        keep;
73           bool        earliest;
74           bool        ignoreselfexpire;
75           char        *filename;
76           time_t      now;
77           float       timewarp;
78       } OVGE;
79
80       void OVclose(void);
81
82

DESCRIPTION

84       Libstorage  is  a  library of common utility (the storage manager) rou‐
85       tines for accessing Usenet articles and  related  data  independent  of
86       particular storage method; this is known as the storage API.  The stor‐
87       age manager's function is to isolate the applications from the individ‐
88       ual  methods  and  make the policy decisions as to which storage method
89       should be called to store an article.
90
91       One of the core concepts in the storage API is that  articles  are  not
92       manipulated  using the message-id or article number, but rather a token
93       that uniquely identifies the article to  the  method  that  stored  it.
94       This  may seem to be redundant since the message-id already is a unique
95       identifier for the article, however, since the storage method generates
96       the  token,  it  can  encode all the information it needs to locate the
97       article in the token.
98
99       ``OV'' is a common utility routines for accessing newsgroups and  over‐
100       view  data independent of particular overview method.  The ``OV'' func‐
101       tion is to isolate the applications from the individual methods.
102
103       All articles passed through the storage API are assumed to be  in  wire
104       format.  Wire format means ``\CR\LF'' at the end of lines, ``.'' at the
105       beginning of lines, and ``.\CR\LF'' at  the  end  of  article  on  NNTP
106       stream  are not stripped.  This has a performance win when transferring
107       articles.  For the ``tradspool'' method, wire format can  be  disabled.
108       This  is just for compatibility which is needed by some old tools writ‐
109       ten for traditional spool.
110
111       IsToken checks to see if the text is formatted as a text token  string.
112       It returns true if formatted correctly or returns false if not.
113
114       TokenToText converts token into text string for output.
115
116       TextToToken converts text into token.
117
118       SMsetup configures some parameters for use by storage manager.  Type is
119       one of following.
120
121            SM_RDWR              allow read/write open for storage
122                                 files (default is false)
123            SM_PREOPEN           open all storage files at startup
124                                 time and keep them (default is false)
125
126       The value is the pointer which tells each  type's  value.   It  returns
127       true if setup is successful, or false if not.
128
129       SMinit calls the setup function for all of the configured methods based
130       on SMsetup.  This function should be called prior to all other  storage
131       API  functions which begin with ``SM'' except SMsetup.  It returns true
132       if initialization is  successful  or  returns  false  if  not.   SMinit
133       returns true, unless all storage methods fail initialization.
134
135       SMstore stores an article specified with article.  If arrived is speci‐
136       fied, SMstore uses its  value  as  article's  arrival  time;  otherwise
137       SMstore  uses  the  current time for it.  SMstore returns token type as
138       type, or returns TOKEN_EMPTY if article  is  not  stored  because  some
139       error  occurs or simply does not match any uwildmat(3) in storage.conf.
140       SMstore fails if SM_RDWR has not been set to true with SMsetup.
141
142       SMretrieve retrieves an article specified with token.   Amount  is  the
143       one of following which specifies retrieving type.
144
145            RETR_ALL             retrieve whole article
146            RETR_HEAD            retrieve headers of article
147            RETR_BODY            retrieve body of article
148            RETR_STAT            just check to see if article exists
149
150
151       The data area indicated by ARTHANDLE should not be modified.
152
153       SMnext  is similar in function to SMretrieve except that it is intended
154       for traversing the method's article store  sequentially.   To  start  a
155       query,  SMnext  should  be  called with a NULL pointer ARTHANDLE.  Then
156       SMnext returns ARTHANDLE which should be used for the next query.  If a
157       NULL pointer ARTHANDLE is returned, no articles are left to be queried.
158       If data of ARTHANDLE is NULL pointer or len of ARTHANDLE is 0, it indi‐
159       cates the article may be corrupted and should be cancelled by SMcancel.
160       The data area indicated by ARTHANDLE should not be modified.
161
162       SMfreearticle frees all allocated memory used by SMretrieve and SMnext.
163       If   SMnext   will   be  called  with  previously  returned  ARTHANDLE,
164       SMfreearticle should not be called as  SMnext  frees  allocated  memory
165       internally.
166
167       SMcancel  removes the article specified with token.  It returns true if
168       cancellation is successful or returns false if not.  SMcancel fails  if
169       SM_RDWR has not been set to true with SMsetup.
170
171       SMprobe checks the token on PROBETYPE.  Type is one of following.
172
173            SELFEXPIRE           checks to see if the method of the token
174                                 has self expire functionality
175            SMARTNGNUM           gets newsgroup name and article number
176                                 of the token.
177
178
179       SMprintfiles shows file name or token usable by fastrm(8).
180
181       SMflushcacheddata  flushes cached data on each storage method.  Type is
182       one of following.
183
184            SM_HEAD              flushes cached header
185            SM_CANCELEDART       flushes articles which should be canceled
186            SM_ALL               flushes all cached data
187
188
189       SMshutdown calls the shutdown for each configured  storage  method  and
190       then frees any resources it has allocated for itself.
191
192       SMerrno and SMerrorstr indicate the reason of the last error concerning
193       storage manager.
194
195       OVopen calls the setup function for configured method which  is  speci‐
196       fied as ``ovmethod'' in inn.conf.  Mode is constructed from following.
197
198            OV_READ              allow read open for overview
199                                 method
200            OV_WRITE             allow write open for overview
201                                 method
202
203       This  function  should  be called prior to all other OV functions which
204       begin with ``OV''.
205
206       OVctl probes or sets some parameters for overview method.  Type is  one
207       of following.
208
209            OVGROUPBASEDEXPIRE   setup how group-based expiry is
210                                 done
211            OVCUTOFFLOW          do not add overview data, if the
212                                 data is under lowest article
213            OVSORT               probe which key is suitable for
214                                 overview method
215            OVSPACE              probe overview space usage
216            OVSTATALL            stat all articles when
217                                 OVexpiregroup is called
218
219
220       OVgroupstats  retrieves  specified  newsgroup information from overview
221       method.
222
223       OVgroupadd informs overview method that specified  newsgroup  is  being
224       added.
225
226       OVgroupdel  informs  overview  method that specified newsgroup is being
227       removed.
228
229       OVadd stores an overview data.
230
231       OVcancel requests the overview method delete  overview  data  specified
232       with token.
233
234       OVopensearch   requests  the  overview  method  prepare  overview  data
235       retrieval.  The request range is determined by low and high.
236
237       OVsearch retrieves  information;  article  number,  overview  data,  or
238       arrival  time.   OVsearch  should be called with NULL handle when it is
239       the first  time;  subsequent  OVsearch  calls  should  use  the  handle
240       returned  by  the  previous  call  to OVsearch.  OVsearch returns true,
241       unless it reaches high which is specified by  OVopensearch.   Retrieved
242       overview  data  are sorted by article number, and len is ``0'' if there
243       is no overview data for article.  Note that the retrieved data  is  not
244       neccessarily  null-terminated;  you  should  only rely on len octets of
245       overview data being present.
246
247       OVclosesearch  frees  all  resources  which  have  been  allocated   by
248       OVopensearch.
249
250       OVgetartinfo retrieves overview data and token specified with artnum.
251
252       OVexpiregroup  expires  overview data for the newsgroup.  OVexpiregroup
253       checks the existense of the article and purges  overview  data  if  the
254       article  no longer exists.  If ``groupbaseexpiry'' in inn.conf is true,
255       OVexpiregroup also expires articles.
256
257       OVclose frees all resources which are used by the overview method.
258

HISTORY

260       Written by Katsuhiro Kondou <kondou@nec.co.jp> for InterNetNews.   This
261       is revision 6124, dated 2003-01-14.
262

SEE ALSO

264       expire(8), inn.conf(5), storage.conf(5).
265
266
267
268                                                                 LIBSTORAGE(3)
Impressum