write-op-impl.h 1.68 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
#ifndef __MOBJECT_WRITE_OP_H
#define __MOBJECT_WRITE_OP_H

#include <margo.h>
#include "mobject-store-config.h"
#include "libmobject-store.h"
Matthieu Dorier's avatar
Matthieu Dorier committed
12
#include "src/io-chain/write-actions.h"
13 14 15 16 17 18

/**
 * The mobject_store_write_op structure is what a
 * mobject_store_write_op_t points to (see typedef in libmobject-store.h).
 * It mainly contains a list of actions ("child" structures of wr_action_base_t).
 * 
Matthieu Dorier's avatar
Matthieu Dorier committed
19
 * When created on the client side, ready is set to 0 and the
20
 * bulk_handle is set to HG_BULK_NULL. The actions in the list may have unions
Matthieu Dorier's avatar
Matthieu Dorier committed
21 22
 * giving the choice between a local pointer (const char*) or a position
 * in a bulk segment (uint64_t).
23 24 25
 * 
 * A call to prepare_bulk_for_write_op will convert all the pointers to
 * positions in a bulk handle and make the object ready to be sent to a server.
Matthieu Dorier's avatar
Matthieu Dorier committed
26
 * It will also set ready to 1, at which point adding more actions
27 28 29 30 31
 * to the list becomes forbiden.
 * 
 * The hg_proc_mobject_store_write_op_t function allows serializing and
 * deserializing the object when sending and receiving it. Serializing only
 * works for a write_op that has been prepared (prepare_bulk_for_write_op has
Matthieu Dorier's avatar
Matthieu Dorier committed
32
 * been called). When deserializing, ready is set 1 and the actions
33 34 35
 * refer to offsets in the bulk_handle.
 */
struct mobject_store_write_op {
Matthieu Dorier's avatar
Matthieu Dorier committed
36 37
	int              ready;        // whether the unions in the actions are 
	                               // to be interpreted as offsets in bulk handles
38 39 40 41 42 43 44
	hg_bulk_t        bulk_handle;  // bulk handle exposing the data
	size_t           num_actions;  // number of action in the linked-list bellow
	wr_action_base_t actions;      // list of actions
};

#endif