I'm making a BBS thing without using sql and I'm wondering what's the best way to save the bump order I'm thinking of having a array-like index that each line has the thread-id but if someone bumps the last thread it has to move everything one line down and insert the last line into the first line do you have any other way to save the index? how does shiichan/tablecat/non-sql forums/4chan do it?
Name:
Anonymous2014-04-27 10:49
Tablecat has an index page that it builds every time a post is made. The page you see on the front page of this board is actually a static page. Nothing is executed when you access the board's front page, the static html is simply served. If I make changes to the board files manually, I need to run the "Rebuild index pages" function from the admin side for it to be reflected on the board's front page / in the thread list.
4chan uses SQL, so does shiichan. I don't know about any other textboards other than tablecat that don't use SQL.
There are ways to make an structured index file such that you don't have to rewrite the entire file if an old thread is bumped, by just having fixed size lines and the ability to handle ``gaps'' in the list, but I don't know if it's really worth the implementation complexity.
>>8 okay, I was thinking something else forgive me
Name:
Anonymous2014-04-27 20:47
If you're using flat files, I suppose you could use a linked list type structure where each thread record contains fields with the IDs of the next and previous threads. That way every time a post is made you can just append and update the head pointer of the last thread. You could use a single file index with fixed size records and thread index IDs or use a maildir like arrangement where each thread is just a directory with symlinks for the next and previous threads.
IANADBA but if you're using a database I'd imagine most SQL databases would make it easy just order threads by timestamp and take the top n threads to generate the front page without the performance being horrible.
Name:
Anonymous2014-04-28 11:23
operations to support
* Go to any thread by key * get a chunk of threads in order by last bump time * order of last bump time is maintained unless a thread is bumped, in which case it is moved to the front of the list
so is there a data structure that provides: * random access * moving an element to the front
>>12 *Random access in sorted order, I should have said.
I would either go with a tree or use an array and settle for the shuffle swap. Most threads that are bumped are already near the top, so the array shuffling isn't that much on average. But then you could be ddosed with necro spam.
Name:
Anonymous2014-04-28 20:08
I would go with array too What kind of tree would you select?
>>26 Because you're a nigger, go fuck a watermelon.
Name:
Anonymous2014-05-28 22:03
honestly filesystems are better than databases and more easy to handle
Name:
Anonymous2014-05-28 22:09
>>28 You can use a filesystem as a database. You can also use cardboard to build a skylift. Depending on the demands of the skylift, you may run into problems.
Remember when microsoft was going to make a relational db filesystem? This thread is giving me the same feeling.
Name:
Anonymous2014-05-28 22:21
>>29 most file systems have all the things that needed in a database and it's really easy to use, one way is to use it as a key-value database (file path + name = key, file = value) and having hard/solf links for many keys with one value with file systems like the apple's one you can do even more things