#include <I_Cache.h>
Inherits VConnection.
Inherited by CacheVC, and ClusterVConnectionBase.
Public Member Functions | |
VIO * | do_io_read (Continuation *c, int64_t nbytes, MIOBuffer *buf)=0 |
Read data from the VConnection. | |
virtual VIO * | do_io_pread (Continuation *c, int64_t nbytes, MIOBuffer *buf, int64_t offset)=0 |
VIO * | do_io_write (Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner=false)=0 |
Write data to the VConnection. | |
void | do_io_close (int lerrno=-1)=0 |
Indicate that the VConnection is no longer needed. | |
void | reenable (VIO *avio)=0 |
void | reenable_re (VIO *avio)=0 |
void | do_io_shutdown (ShutdownHowTo_t howto) |
Terminate one or both directions of the VConnection. | |
virtual int | get_header (void **ptr, int *len)=0 |
virtual int | set_header (void *ptr, int len)=0 |
virtual int | get_single_data (void **ptr, int *len)=0 |
virtual bool | is_ram_cache_hit () const =0 |
virtual bool | set_disk_io_priority (int priority)=0 |
virtual int | get_disk_io_priority ()=0 |
virtual bool | set_pin_in_cache (time_t t)=0 |
virtual time_t | get_pin_in_cache ()=0 |
virtual int64_t | get_object_size ()=0 |
virtual bool | is_pread_capable ()=0 |
Test if the VC can support pread. | |
CacheVConnection () |
Definition at line 202 of file I_Cache.h.
void CacheVConnection::do_io_close | ( | int | lerrno = -1 |
) | [pure virtual] |
Indicate that the VConnection is no longer needed.
Once the state machine has finished using this VConnection, it must call this function to indicate that the VConnection can be deallocated. After a close has been called, the VConnection and underlying processor must not send any more events related to this VConnection to the state machine. Likeswise, the state machine must not access the VConnection or any VIOs obtained from it after calling this method.
lerrno | indicates where a close is a normal close or an abort. The difference between a normal close and an abort depends on the underlying type of the VConnection. |
Implements VConnection.
Implemented in CacheVC, ClusterVConnectionBase, and ClusterVConnection.
Referenced by CacheTestSM::event_handler().
virtual VIO* CacheVConnection::do_io_pread | ( | Continuation * | c, | |
int64_t | nbytes, | |||
MIOBuffer * | buf, | |||
int64_t | offset | |||
) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnectionBase.
VIO* CacheVConnection::do_io_read | ( | Continuation * | c, | |
int64_t | nbytes, | |||
MIOBuffer * | buf | |||
) | [pure virtual] |
Read data from the VConnection.
Called by a state machine to read data from the VConnection. Processors implementing read functionality take out lock, put new bytes on the buffer and call the continuation back before releasing the lock in order to enable the state machine to handle transfer schemes where the end of a given transaction is marked by a special character (ie: NNTP).
Possible Event Codes
On the callback to the continuation, the VConnection may use on of the following values for the event code:
Event code | Meaning |
VC_EVENT_READ_READY | Data has been added to the buffer or the buffer is full |
VC_EVENT_READ_COMPLETE | The amount of data indicated by 'nbytes' has been read into the buffer |
VC_EVENT_EOS | The stream being read from has been shutdown |
VC_EVENT_ERROR | An error occurred during the read |
c | Continuation to be called back with events. | |
nbytes | Number of bytes to read. If unknown, nbytes must be set to INT64_MAX. | |
buf | buffer to read into. |
Implements VConnection.
Implemented in CacheVC, ClusterVConnectionBase, and ClusterVConnection.
Referenced by CacheTestSM::open_read_callout().
void CacheVConnection::do_io_shutdown | ( | ShutdownHowTo_t | howto | ) | [inline, virtual] |
Terminate one or both directions of the VConnection.
Indicates that one or both sides of the VConnection should be terminated. After this call is issued, no further I/O can be done on the specified direction of the connection. The processor must not send any further events (including timeout events) to the state machine, and the state machine must not use any VIOs from a shutdown direction of the connection. Even if both sides of a connection are shutdown, the state machine must still call do_io_close() when it wishes the VConnection to be deallocated.
Possible howto values
Value | Meaning |
IO_SHUTDOWN_READ | Indicates that this VConnection should not generate any more read events |
IO_SHUTDOWN_WRITE | Indicates that this VConnection should not generate any more write events |
IO_SHUTDOWN_READWRITE | Indicates that this VConnection should not generate any more read nor write events |
howto | Specifies which direction of the VConnection to shutdown. |
Implements VConnection.
Reimplemented in ClusterVConnectionBase.
Definition at line 210 of file I_Cache.h.
References ink_assert.
VIO* CacheVConnection::do_io_write | ( | Continuation * | c, | |
int64_t | nbytes, | |||
IOBufferReader * | buf, | |||
bool | owner = false | |||
) | [pure virtual] |
Write data to the VConnection.
This method is called by a state machine to write data to the VConnection.
Possible Event Codes
On the callback to the continuation, the VConnection may use on of the following event codes:
Event code | Meaning |
VC_EVENT_WRITE_READY | Data was written from the reader or there are no bytes available for the reader to write. |
VC_EVENT_WRITE_COMPLETE | The amount of data indicated by 'nbytes' has been written to the VConnection |
VC_EVENT_INACTIVITY_TIMEOUT | No activity was performed for a certain period. |
VC_EVENT_ACTIVE_TIMEOUT | Write operation continued beyond a time limit. |
VC_EVENT_ERROR | An error occurred during the write |
c | Continuation to be called back with events. | |
nbytes | Number of bytes to write. If unknown, nbytes must be set to INT64_MAX. | |
buf | Reader whose data is to be read from. | |
owner |
Implements VConnection.
Implemented in CacheVC, ClusterVConnectionBase, and ClusterVConnection.
Referenced by CacheTestSM::open_write_callout().
virtual int CacheVConnection::get_disk_io_priority | ( | ) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual int CacheVConnection::get_header | ( | void ** | ptr, | |
int * | len | |||
) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual int64_t CacheVConnection::get_object_size | ( | ) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual time_t CacheVConnection::get_pin_in_cache | ( | ) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual int CacheVConnection::get_single_data | ( | void ** | ptr, | |
int * | len | |||
) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual bool CacheVConnection::is_pread_capable | ( | ) | [pure virtual] |
Test if the VC can support pread.
true
if do_io_pread
will work, false
if not. Implemented in CacheVC, and ClusterVConnection.
Referenced by HttpSM::do_range_setup_if_necessary().
virtual bool CacheVConnection::is_ram_cache_hit | ( | ) | const [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
void CacheVConnection::reenable | ( | VIO * | avio | ) | [pure virtual] |
Reimplemented from VConnection.
Implemented in CacheVC, ClusterVConnectionBase, and ClusterVConnection.
void CacheVConnection::reenable_re | ( | VIO * | avio | ) | [pure virtual] |
Reimplemented from VConnection.
Implemented in CacheVC, and ClusterVConnectionBase.
virtual bool CacheVConnection::set_disk_io_priority | ( | int | priority | ) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual int CacheVConnection::set_header | ( | void * | ptr, | |
int | len | |||
) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.
virtual bool CacheVConnection::set_pin_in_cache | ( | time_t | t | ) | [pure virtual] |
Implemented in CacheVC, and ClusterVConnection.