From: wessels <> Date: Thu, 20 May 1999 04:33:36 +0000 (+0000) Subject: added store filesystem docs X-Git-Tag: SQUID_3_0_PRE1~2196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a5fc2831ebbe696af90da86c0dd0c0f8fb62e39;p=thirdparty%2Fsquid.git added store filesystem docs --- diff --git a/doc/Programming-Guide/prog-guide.sgml b/doc/Programming-Guide/prog-guide.sgml index 5e37b74e62..b50d0dc434 100644 --- a/doc/Programming-Guide/prog-guide.sgml +++ b/doc/Programming-Guide/prog-guide.sgml @@ -654,6 +654,251 @@ Squid consists of the following major components Storage Manager + +Filesystem Interface + +Introduction + +

+ Traditionally, Squid has always used the Unix filesystem (UFS) + to store cache objects on disk. Over the years, the + poor performance of UFS has become very obvious. In most + cases, UFS limits Squid to about 30-50 requests per second. + Our work indicates that the poor performance is mostly + due to the synchronous nature of + We want to try out our own, customized filesystems with Squid. + In order to do that, we need a well-defined interface + for the bits of Squid that access the permanent storage + devices. + +The Interface + +Data Structures + + + Every cache object that is ``opened'' for reading or writing + will have an + struct _storeIOState { + int fd; + sfileno swap_file_number; + mode_t mode; + size_t st_size; /* do stat(2) after read open */ + off_t offset; /* current offset pointer */ + STIOCB *callback; + void *callback_data; + struct { + STRCB *callback; + void *callback_data; + } read; + struct { + unsigned int closing:1; /* debugging aid */ + } flags; + union { + struct { + struct { + unsigned int close_request:1; + unsigned int reading:1; + unsigned int writing:1; + } flags; + } ufs; + } type; + }; + + + External Functions + + + Prototype: + + storeIOState * + storeOpen(sfileno f, mode_t mode, STIOCB *callback, void *callback_data) + + +

+ + + Prototype: + + void + storeClose(storeIOState *sio) + + +

+ + Prototype: + + void + storeRead(storeIOState *sio, char *buf, size_t size, off_t offset, STRCB *callback, void *callback_data) + + +

+ + The caller is responsible for allocating and freeing + Prototype: + + void + storeWrite(storeIOState *sio, char *buf, size_t size, off_t offset, FREE *free_func) + + +

+ + If a write operation fails, the filesystem layer notifies the + calling module by calling the + Prototype: + + void + storeUnlink(sfileno f) + + +

+ + Prototype: + + off_t + storeOffset(storeIOState *sio) + + +

+ Returns the current byte-offset of the cache object + on disk. + + + Prototype: + + void + stiocb(void *data, int errorflag, storeIOState *sio) + + +

+ The + + #define DISK_OK (0) + #define DISK_ERROR (-1) + #define DISK_EOF (-2) + #define DISK_NO_SPACE_LEFT (-6) + + +

+ Once the The + Prototype: + + void + strcb(void *data, const char *buf, size_t len) + + +

+ The Forwarding Selection