1 /* $Id: tape.h 6647 2004-01-25 20:06:42Z rra $ 2 ** 3 ** The public interface to the Tape class. 4 ** 5 ** Written by James Brister <brister@vix.com> 6 ** 7 ** The Tape class simulates a mag tape. It only reads or writes Articles. A 8 ** tape is either in an Input or Output state. When an Article is given to a 9 ** Tape it will store the Article in memory until it reaches a highwater mark 10 ** at which point it dumps all it's articles to disk. 11 ** 12 ** Input tapes generate article objects on request if the underlying tape 13 ** file has info in it. The Tapes take care of cleaning up used-up files as 14 ** needed. 15 */ 16 17 #if ! defined ( tape_h__ ) 18 #define tape_h__ 19 20 #include <stdio.h> 21 22 #include "misc.h" 23 24 25 /* If dontRotate is true, then any articles that get written to the tape 26 will never be read back in again. This is for the batch-mode-only case 27 where articles written to tape were done so 'cause the remote 28 temporarily rejected them. */ 29 Tape newTape (const char *peerName, bool dontRotate) ; 30 31 void gPrintTapeInfo (FILE *fp, unsigned int inedntAmt) ; 32 void printTapeInfo (Tape tape, FILE *fp, unsigned int indentAmt) ; 33 34 /* deletes the tape objects. If it has any articles cached then it dumps 35 them to the disk. */ 36 void delTape (Tape tape) ; 37 38 /* give an article to the Tape for storage */ 39 void tapeTakeArticle (Tape tape, Article article) ; 40 41 /* get a new article from an Input tape. */ 42 Article getArticle (Tape tape) ; 43 44 /* close the input and output files and reopen them. */ 45 void gFlushTapes (void) ; 46 void tapeFlush (Tape tape) ; 47 48 49 /**************************************************/ 50 /* CLASS LEVEL FUNCTIONS */ 51 /**************************************************/ 52 53 /* get all the active input tapes to checkpoint their current positions */ 54 void checkPointTapes (void) ; 55 56 /* get the name of the directory tapes are being stored in. */ 57 const char *getTapeDirectory (void) ; 58 59 /* set the size limit of the output tapes. Default is zero which is no 60 limit. */ 61 void setOutputSizeLimit (long limit) ; 62 63 int tapeConfigLoadCbk (void *data) ; 64 65 void tapeLogGlobalStatus (FILE *fp) ; 66 void tapeLogStatus (Tape tape, FILE *fp) ; 67 68 #endif /* tape_h__ */ 69