dp_ptask.h revision ab0ab5a30379b84d6e05e1f2dc457bd1dd97401f
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2013 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DP_PTASK_H_
#define _DP_PTASK_H_
#include <tevent.h>
#include <talloc.h>
#include <time.h>
/* solve circular dependency */
struct be_ctx;
struct be_ptask;
/**
* Defines how should task behave when back end is offline.
*/
enum be_ptask_offline {
/* current request will be skipped and rescheduled to 'now + period' */
/* An offline and online callback is registered. The task is disabled
* immediately when back end goes offline and then enabled again
* when back end goes back online */
/* current request will be executed as planned */
};
typedef struct tevent_req *
struct tevent_context *ev,
void *pvt);
/**
* If EOK, task will be scheduled again to 'last_execution_time + period'.
* If other error code, task will be rescheduled to 'now + period'.
*/
typedef errno_t
/**
* If EOK, task will be scheduled again to 'last_execution_time + period'.
* If other error code, task will be rescheduled to 'now + period'.
*/
typedef errno_t
struct tevent_context *ev,
void *pvt);
/**
* The first execution is scheduled first_delay seconds after the task is
* created.
*
* If request does not complete in timeout seconds, it will be
* cancelled and rescheduled to 'now + period'.
*
* If the task is reenabled, it will be scheduled again to
* 'now + enabled_delay'.
*
* The random_offset is maximum number of seconds added to the
* expected delay. Set to 0 if no randomization is needed.
*
* If an internal error occurred, the task is automatically disabled.
*/
enum be_ptask_offline offline,
void *pvt,
const char *name,
enum be_ptask_offline offline,
void *pvt,
const char *name,
#endif /* _DP_PTASK_H_ */