annotate docs/INTERNALS @ 143:7400a8e9d5ba noffle

[svn] NEWS,src/client.c,src/protocol.c,src/protocol.h,src/server.c: Added timeout to Prt_getLn to avoid Noffle hanging if the connection breaks down during a fetch.
author enz
date Sat, 23 Sep 2000 11:37:01 +0100
parents 9cf0d605465a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
1 -------------------------------------------------------------------------------
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
2 NOFFLE Internals
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
3 -------------------------------------------------------------------------------
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
4
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
5 This document is, for the moment, a collection of jottings on aspects
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
6 of Noffle internals.One day it might make it into something resembling
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
7 documentation, but I wouldn't put your money on it. Use the Source,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
8 Luke!
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
9
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
10 1. Where do things get stored?
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
11
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
12 Articles: Articles are held keyed by Message-ID in the articles
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
13 database, articles.gdbm. This is handled by database.[hc]. Articles
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
14 are marked with a status, indicating if they were only partially
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
15 downloaded (think overview mode) or if something went wrong on
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
16 retrieval.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
17
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
18 Groups: The list of groups known is held in the groups database,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
19 groupinfo.gdbm, keyed on group name. This holds the group first and
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
20 last article numbers, the last article number read on the remote
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
21 server, group creation and last access times, plus the group
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
22 description, the name of the server from which the group is drawn and
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
23 a flag indicating if posting to the group is allowed.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
24
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
25 Local groups are indicated as belonging to a special server. They are
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
26 for the most part treated identically to remote groups (though the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
27 whole business of auto-subscribe and auto-unsubscribe obviously
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
28 doesn't apply, and posting operates locally).
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
29
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
30 The fetchlist (fetchlist.[hc]) holds the list of group names Noffle
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
31 currently subscribes to, and the subscription mode.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
32
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
33 Subscribed groups may have a file with their name in the overview
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
34 directory. This file - the overview file - contains details of the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
35 articles in the group that can currently be read from the server. Each
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
36 entry in the file is an overview (over.[hc]), while a group overview
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
37 file is handled by content.[hc]. If no articles are left in a group,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
38 the overview file is deleted.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
39
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
40 The Noffle server loads the overview for a group into memory when it
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
41 needs to manipulate the group and uses its reckoning on the first and
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
42 last article number from there on. This may not correspond with the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
43 first and last number given in the groups database entry. Typically,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
44 the database first and last entries are updated from the overview on
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
45 completion of actions affecting the group.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
46
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
47 Outbound articles are placed in a directory under the Noffle spool
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
48 'outgoing' directory. Each is in its own file, named by the article
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
49 Message-ID, in a directory with the name of the server. outgoing.[hc]
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
50 handle tracking what outbound messages are queued and queueing new ones.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
51 When Noffle connects to the appropriate server, the message is posted
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
52 on and the file removed.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
53
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
54 2. Posting
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
55
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
56 Posting to remote groups is straightforward; the article is placed in
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
57 the outgoing queue, and will be read back from the server as part of
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
58 collecting new messages for the group. The article is placed once only
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
59 in the queue, regardless of the number of external groups, as it only
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
60 needs to appear once on the remote server. Articles posted only to
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
61 newsgroups unknown to Noffle are rejected.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
62
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
63 If the group is marked as 'can't post' ('n' in LIST ACTIVE) the post
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
64 is rejected immediately. Note you can't have moderated local groups at
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
65 the moment; you can have read-only ones, though.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
66
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
67 Control message are similarly passed on, unless the control is
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
68 'cancel' and the cancel can be done entirely locally because the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
69 article is still in the outgoing queue.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
70
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
71 Posts to local groups appear in the article database
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
72 immediately. Control messages (control.[hc]) for local groups are
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
73 honoured, though currently only 'cancel' does anything.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
74
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
75 Things get more complex when an article is cross-posted to a local and
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
76 remote group. Essentially, both the above happen; if the remote server
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
77 does not change the Message-ID, the local copy will be the definitive
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
78 for both groups. Obviously if the remote server does change the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
79 Message-ID, Noffle will tread the article coming back from the server
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
80 as a new one.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
81
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
82 post.[hc] holds the code for posting local articles.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
83
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
84 The posting code in post 1.0 Noffle should (i.e. I'll do it if time
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
85 permits) be rearranged to provide one function to post (or reject) an
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
86 article regardless of original source. This would hopefully make it
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
87 clearer what happens during a post, and make it easy to add a
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
88 command-line article post function, which could remove the necessity
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
89 for Python or Perl intervention gateing mailing lists into local newsgroups.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
90
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
91 3. Pseudo articles
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
92
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
93 Noffle generates various pseudo articles itself (see pseudo.[hc]), to
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
94 inform the user of changes of state or to give instruction. All but
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
95 one are, in fact, done by generating and posting a regular article,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
96 but one is special; the general information article.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
97
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
98 The gen info article is the one shown when one tries to read from a
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
99 currently unsubscribed (Noffle is not subscribed to it, that it)
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
100 newsgroup. It is apparently present in every single group known to
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
101 Noffle, but is faked; it never appears in the article database. LIST
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
102 ACTIVE fakes the first and last article numbers for a group if it
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
103 knows the group is not subscribed to (and not local), and entry to a
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
104 group with the GROUP command will cause an overview to be added to the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
105 group overview in memory only. If the article is not read, the
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
106 overview is lost unsaved when moving to the next group.
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
107
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
108 Reading the article triggers stuff happening. If auto-subscribe is on,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
109 a pseudo article confirming subcription is posted and the group
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
110 overview saved. Gen info articles are not normally saved in overviews,
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
111 but to prevent them vanishing very suddenly their overview is saved
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
112 with other articles in the group if they form part of the sequence of
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
113 the group. In this case it will persist until the subscription confirm
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
114 article expires. This will not stop another gen info being generated
9cf0d605465a [svn] Move INTERNALS to docs/
bears
parents:
diff changeset
115 if (say) the group gets auto-unsubscribed.