3
A brief file description
5
@section license License
7
Licensed to the Apache Software Foundation (ASF) under one
8
or more contributor license agreements. See the NOTICE file
9
distributed with this work for additional information
10
regarding copyright ownership. The ASF licenses this file
11
to you under the Apache License, Version 2.0 (the
12
"License"); you may not use this file except in compliance
13
with the License. You may obtain a copy of the License at
15
http://www.apache.org/licenses/LICENSE-2.0
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
24
/****************************************************************************
26
Async Disk IO operations.
30
****************************************************************************/
31
#if !defined (_I_AIO_h_)
39
#include "I_EventSystem.h"
40
#include "I_RecProcess.h"
42
#define AIO_MODULE_MAJOR_VERSION 1
43
#define AIO_MODULE_MINOR_VERSION 0
44
#define AIO_MODULE_VERSION makeModuleVersion(AIO_MODULE_MAJOR_VERSION,\
45
AIO_MODULE_MINOR_VERSION,\
48
#define AIO_EVENT_DONE (AIO_EVENT_EVENTS_START+0)
50
#define AIO_MODE_AIO 0
51
#define AIO_MODE_SYNC 1
52
#define AIO_MODE_THREAD 2
53
#define AIO_MODE AIO_MODE_THREAD
55
// AIOCallback::thread special values
56
#define AIO_CALLBACK_THREAD_ANY ((EThread*)0) // any regular event thread
57
#define AIO_CALLBACK_THREAD_AIO ((EThread*)-1)
59
#define AIO_LOWEST_PRIORITY 0
60
#define AIO_DEFAULT_PRIORITY AIO_LOWEST_PRIORITY
62
struct AIOCallback: public Continuation
64
// set before calling aio_read/aio_write
69
// set on return from aio_read/aio_write
73
AIOCallback() : thread(AIO_CALLBACK_THREAD_ANY), then(0) {
74
aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY;
78
void ink_aio_init(ModuleVersion version);
80
void ink_aio_set_callback(Continuation * error_callback);
82
int ink_aio_read(AIOCallback *op, int fromAPI = 0); // fromAPI is a boolean to indicate if this is from a API call such as upload proxy feature
83
int ink_aio_write(AIOCallback *op, int fromAPI = 0);
84
int ink_aio_thread_num_set(int thread_num);
85
AIOCallback *new_AIOCallback(void);