3 #include "SquidConfig.h"
7 StoreIoStats store_io_stats
;
10 * submit a request to create a cache object for writing.
11 * The StoreEntry structure is sent as a hint to the filesystem
12 * to what will be stored in this object, to allow the filesystem
13 * to select different polices depending on object size or type.
16 storeCreate(StoreEntry
* e
, StoreIOState::STFNCB
* file_callback
, StoreIOState::STIOCB
* close_callback
, void *callback_data
)
20 ++store_io_stats
.create
.calls
;
24 * We assume that the header has been packed by now ..
26 const sdirno dirn
= storeDirSelectSwapDir(e
);
29 debugs(20, 2, "storeCreate: no swapdirs for " << *e
);
30 ++store_io_stats
.create
.select_fail
;
34 debugs(20, 2, "storeCreate: Selected dir " << dirn
<< " for " << *e
);
35 SwapDir
*SD
= dynamic_cast<SwapDir
*>(INDEXSD(dirn
));
37 /* Now that we have a fs to use, call its storeCreate function */
38 StoreIOState::Pointer sio
= SD
->createStoreIO(*e
, file_callback
, close_callback
, callback_data
);
41 ++store_io_stats
.create
.create_fail
;
43 ++store_io_stats
.create
.success
;
49 * storeOpen() is purely for reading ..
52 storeOpen(StoreEntry
* e
, StoreIOState::STFNCB
* file_callback
, StoreIOState::STIOCB
* callback
,
55 return dynamic_cast<SwapDir
*>(e
->store().getRaw())->openStoreIO(*e
, file_callback
, callback
, callback_data
);
59 storeClose(StoreIOState::Pointer sio
, int how
)
61 if (sio
->flags
.closing
) {
62 debugs(20,3,HERE
<< "storeClose: flags.closing already set, bailing");
66 sio
->flags
.closing
= true;
68 debugs(20,3,HERE
<< "storeClose: calling sio->close(" << how
<< ")");
73 storeRead(StoreIOState::Pointer sio
, char *buf
, size_t size
, off_t offset
, StoreIOState::STRCB
* callback
, void *callback_data
)
75 sio
->read_(buf
, size
, offset
, callback
, callback_data
);
79 storeIOWrite(StoreIOState::Pointer sio
, char const *buf
, size_t size
, off_t offset
, FREE
* free_func
)
81 sio
->write(buf
,size
,offset
,free_func
);