🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90311

Re: working with cnfs

#90311
From: Adam W.
Date: Tue, 18 Apr 2023 10:51
41 lines
3048 bytes
Nigel Reed <sysop@endofthelinebbs.com> wrote:

> Unfortunately the queries would be ad-hoc. I was looking at CPAN,
> 212,470 modules and nothing to work with CNFS. 

If you're into Perl, you could see the source of cnfsstat. It parses 
buffers directly.

I'm looking into include/inn/storage.h (it's used by storage manager, 
frontends/sm.c). Seems there's a nice API to retrieve all articles one by 
one:

ARTHANDLE *SMnext(ARTHANDLE *article, const RETRTYPE amount);

There's also a manual page in doc/man/libinnstorage.3 (man libinnstorage). 
If you want to write something to retrieve articles from CNFS (or, in 
general, from storage manager), you could start there.

"The SMnext function is similar in function to SMretrieve except that it 
is intended for traversing the method's article store sequentially.  To 
start a query, SMnext should be called with a NULL pointer ARTHANDLE.  
Then SMnext returns ARTHANDLE which should be used for the next query.  If 
a NULL pointer ARTHANDLE is returned, no articles are left to be queried.  
If data of ARTHANDLE is NULL pointer or len of ARTHANDLE is 0, it 
indicates the article may be corrupted and should be cancelled by 
SMcancel.  The data area indicated by ARTHANDLE should not be modified."

There's also some overview search function, but it's not for article 
bodies, so it probably won't be useful.

One could write a program that retrieves articles one by one and performs 
some operations on them -- for example, matching them with regex (there's 
a regexec API for that, declared in regex.h) and if regex matches, 
printing some information (storage token, or Message-ID, or whatever). 
ARTHANDLE structure (defined in include/inn/storage.h) contains all 
required data, including storage token.

Anyway, if you want to do a text search, it would be best if you made a 
dictionary first (for example, linking all words to tokens that contain 
them), but it would be better to use a ready-made indexer for that (there 
has to be one)...
Technical Details
Message-ID: <u1lsmm$nuk$1$arnold@news.chmurka.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <20230417103454.440dbdc0@wibble.sysadmininc.com> <u1ke7c$634$1$arnold@news.chmurka.net> <20230417173141.795d85a5@wibble.sysadmininc.com>

Show Full Headers
Complete Article Headers
Message-ID: <u1lsmm$nuk$1$arnold@news.chmurka.net>
Subject: Re: working with cnfs
Date: Tue, 18 Apr 2023 10:51:02 +0000
From: gof-cut-this-news@cut-this-chmurka.net.invalid (Adam W.)
References: <20230417103454.440dbdc0@wibble.sysadmininc.com> <u1ke7c$634$1$arnold@news.chmurka.net> <20230417173141.795d85a5@wibble.sysadmininc.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: news.chmurka.net
Nntp-Posting-Host: s.v.chmurka.net
Injection-Date: Tue, 18 Apr 2023 10:51:02 -0000 (UTC)
Injection-Info: news.chmurka.net; posting-account="arnold"; posting-host="s.v.chmurka.net:172.24.44.20"; logging-data="24532"; mail-complaints-to="abuse-news.(at).chmurka.net"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.32-v7+ (armv7l))
Cancel-Lock: sha1:BQ5gxcL/C6iwE7JiOmpYH86afkY=