Navigating with Tracker


The Author Describes His Intent

Binary files have their place but frankly I don't like them very much. By their very nature they are extremely specialized, usable in only a very narrow range of situations. If you, as a lowly human being, are presented with a binary file that you know little or nothing about you probably aren't going to learn anything new by examining it. Dump it in a hex editor and it will almost certainly look like garbage.

Text files, on the other hand, are the lingua franca of the computer world. While the various computer architectures can't agree on what constitutes a text file line break, they all use text files that are more or less interoperable. If you are presented with a text file that you know little or nothing about chances are excellent that you can figure out what it's for by examining it. It's too bad that their limited range of characters favors English-speaking cultures but you can't have everything.

Therefore I like to do my part to make the world a place with more text files and fewer binaries. Pineapple News reads and writes nothing but text files. Really! It saves its settings in text files, PineappleNews.ini and one Server.ini for each server account. Pineapple Message Files are text files with some BFS attributes. The list of server newsgroups is saved in a text file called Newsgroups.txt, one for each server. The one place where I sort of "cheat" is that I save information about newsgroups as binary BFS attributes attached to the newsgroup's folder. Early in the program's existence I saved the data in Newsgroups.ini, one inside each newsgroup folder, but I didn't like it. I wanted the newsgroup folders to contain nothing but article files. It would be too easy to think "I want to get rid of all those unnecessary articles in the alt.really.stupid newsgroup" so you select every single file and throw them all in the trash. Ooops, you just trashed your newsgroup settings. Personally I have to empty the trash very frequently, due to development issues with Pineapple News I won't bore you with, so the file would probably be long gone before I noticed it was missing.

So. The fact that all of the program's data is just text files in a series of folders, combined with Tracker's ability to display files with BFS attributes as if they were records in a database, means that Pineapple News is ideally suited to being managed with Tracker. Hence this help topic.

A few words on program architecture

To understand the rest of what follows I'll have to briefly fill you in on a few of the details of how Pineapple News works internally. The most important detail is what I call the "node number," which is the same thing that UNIX has traditionally called an "inode" (I think. I am no UNIX whiz, that's for sure). Every file and folder on a BFS volume has an identifying node number, which is just a big positive 64-bit integer.

Internally I need a "magic cookie" to uniquely identify objects like servers and newsgroups. When one module calls another with a request to, say, download all the articles in a newsgroup, I need a way to identify which server and which newsgroup. The alternative would be to schlep around every single bit of known data for every operation, but that's impractical. First off it would be slow doing all those lengthy memory-to-memory copies, and secondly you'd have potentially dozens of copies of the same data flying around, each subsystem modifying their own copy, so pretty soon the various copies would be out of sync with each other. Too ugly to think about. So the subsystems pass integers to each other instead and when they need specifics, like what folder the object lives in or the username and password, the magic cookie is passed to a central authority I call the Barn which maintains the one and only copy of the data. (You know, the barn. Where the horses live. Ha ha.) So when I found out that it was easy to get the node number for a particular folder I started using them as my "magic cookie" identifiers. Therefore the headache of generating the numbers and making sure that they are unique (i.e., no two objects have exactly the same node number) becomes Somebody Else's Problem, namely, the file system's. (Thank you, Dominic Giampaolo. Too bad he quit.)

So. To summarize, Pineapple News uses BFS node numbers to uniquely identify servers, newsgroups, message files, and other entities. End of lecture.

Things you can do, and things you can't

This is where I ran out of steam, because this part will be boring. At least to me.


Help Index