completion.h 1.46 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1
2
3
4
5
6
7
8
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
#ifndef __MOBJECT_COMPLETION_H
#define __MOBJECT_COMPLETION_H

Matthieu Dorier's avatar
Matthieu Dorier committed
9
#include <margo.h>
Matthieu Dorier's avatar
Matthieu Dorier committed
10
#include "mobject-store-config.h"
11
12
13
14
15
16
17
18
#include "libmobject-store.h"

typedef enum completion_op_type {
    AIO_NULL_COMPLETION,
    AIO_WRITE_COMPLETION,
    AIO_READ_COMPLETION
} completion_op_type;

Matthieu Dorier's avatar
Matthieu Dorier committed
19
20
21
22
23
24
25
26
27
/**
 * The mobject_store_completion object is used for asynchronous
 * functions. It contains the callbacks to call when the data is
 * safe and when the operation has completed, as well as potential
 * user data and required mechanism to be able to block on the
 * completion object.
 * mobject_store_completion* is typedef-ed as mobject_store_completion_t
 * in libmobject-store.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
28
struct mobject_store_completion {
29
30
31
32
33
    completion_op_type       type;           // completion for write or for reads
    union {
        mobject_store_read_op_t read_op;
        mobject_store_write_op_t write_op;
    } op;                                    // operation that initiated the completion
Matthieu Dorier's avatar
Matthieu Dorier committed
34
35
36
	mobject_store_callback_t cb_complete;    // completion callback
	mobject_store_callback_t cb_safe;        // safe callback
	void*                    cb_arg;         // arguments for callbacks
Matthieu Dorier's avatar
Matthieu Dorier committed
37
	margo_request            request;        // margo request to wait on
38
    hg_handle_t              handle;         // handle of the RPC sent for this operation
Matthieu Dorier's avatar
Matthieu Dorier committed
39
	int                      ret_value;      // return value of the operation
Matthieu Dorier's avatar
Matthieu Dorier committed
40
41
42
43
};

#endif