Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
bake
Commits
9bcec8fc
Commit
9bcec8fc
authored
May 07, 2016
by
Philip Carns
Browse files
client-side code for bulk write
parent
6e313ec0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bake-bulk.c
View file @
9bcec8fc
...
...
@@ -19,10 +19,15 @@ struct bake_instance
hg_context_t
*
hg_context
;
};
struct
bake_instance
g_binst
;
/* TODO: replace later, hard coded global instance */
static
hg_id_t
g_bake_bulk_shutdown_id
;
/* TODO: probably not global in the long run either */
static
hg_id_t
g_bake_bulk_create_id
;
/* TODO: probably not global in the long run either */
static
hg_id_t
g_bake_bulk_write_id
;
/* TODO: probably not global in the long run either */
/* TODO: replace later, hard coded global instance */
struct
bake_instance
g_binst
;
/* TODO: probably not global in the long run either */
static
hg_id_t
g_bake_bulk_shutdown_id
;
/* TODO: probably not global in the long run either */
static
hg_id_t
g_bake_bulk_create_id
;
/* TODO: probably not global in the long run either */
static
hg_id_t
g_bake_bulk_write_id
;
int
bake_probe_instance
(
const
char
*
mercury_dest
,
...
...
@@ -137,8 +142,54 @@ int bake_bulk_write(
void
const
*
buf
,
uint64_t
buf_size
)
{
hg_return_t
hret
;
hg_handle_t
handle
;
bake_bulk_write_in_t
in
;
bake_bulk_write_out_t
out
;
int
ret
;
in
.
bti
=
bti
;
in
.
rid
=
rid
;
in
.
region_offset
=
region_offset
;
return
(
-
1
);
hret
=
HG_Bulk_create
(
g_binst
.
hg_class
,
1
,
(
void
**
)(
&
buf
),
&
buf_size
,
HG_BULK_READ_ONLY
,
&
in
.
bulk_handle
);
if
(
hret
!=
HG_SUCCESS
)
{
return
(
-
1
);
}
/* create handle */
hret
=
HG_Create
(
g_binst
.
hg_context
,
g_binst
.
dest
,
g_bake_bulk_write_id
,
&
handle
);
if
(
hret
!=
HG_SUCCESS
)
{
HG_Bulk_free
(
in
.
bulk_handle
);
return
(
-
1
);
}
hret
=
margo_forward
(
g_binst
.
mid
,
handle
,
&
in
);
if
(
hret
!=
HG_SUCCESS
)
{
HG_Destroy
(
handle
);
HG_Bulk_free
(
in
.
bulk_handle
);
return
(
-
1
);
}
hret
=
HG_Get_output
(
handle
,
&
out
);
if
(
hret
!=
HG_SUCCESS
)
{
HG_Destroy
(
handle
);
HG_Bulk_free
(
in
.
bulk_handle
);
return
(
-
1
);
}
ret
=
out
.
ret
;
HG_Free_output
(
handle
,
&
out
);
HG_Destroy
(
handle
);
HG_Bulk_free
(
in
.
bulk_handle
);
return
(
ret
);
}
int
bake_bulk_create
(
...
...
@@ -152,6 +203,9 @@ int bake_bulk_create(
bake_bulk_create_out_t
out
;
int
ret
;
in
.
bti
=
bti
;
in
.
region_size
=
region_size
;
/* create handle */
hret
=
HG_Create
(
g_binst
.
hg_context
,
g_binst
.
dest
,
g_bake_bulk_create_id
,
&
handle
);
...
...
@@ -160,9 +214,6 @@ int bake_bulk_create(
return
(
-
1
);
}
in
.
bti
=
bti
;
in
.
region_size
=
region_size
;
hret
=
margo_forward
(
g_binst
.
mid
,
handle
,
&
in
);
if
(
hret
!=
HG_SUCCESS
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment