Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mobject-store
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
13
Issues
13
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
mobject-store
Commits
336b01ae
Commit
336b01ae
authored
Nov 09, 2017
by
Shane Snyder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorg client cluster & io-context code
parent
d1632836
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
81 deletions
+78
-81
libmobject-store.h
include/libmobject-store.h
+1
-1
Makefile.subdir
src/Makefile.subdir
+4
-6
cluster.c
src/client/cluster.c
+45
-29
cluster.h
src/client/cluster.h
+28
-0
io-context.c
src/client/io-context.c
+0
-27
io-context.h
src/client/io-context.h
+0
-18
No files found.
include/libmobject-store.h
View file @
336b01ae
...
...
@@ -102,7 +102,7 @@ enum {
* libmobject_store users must synchronize any of these changes on their own,
* or use separate io contexts for each thread
*/
typedef
struct
mobject_ioctx
*
mobject_store_ioctx_t
;
typedef
struct
mobject_
store_
ioctx
*
mobject_store_ioctx_t
;
/**
* @typedef mobject_store_omap_iter_t
...
...
src/Makefile.subdir
View file @
336b01ae
noinst_HEADERS
+=
\
src/client/cluster.h
\
src/client/aio/completion.h
\
src/client/cluster-handle.h
\
src/client/io-context.h
\
src/io-chain/args-read-actions.h
\
src/io-chain/args-write-actions.h
\
src/io-chain/prepare-read-op.h
\
...
...
@@ -46,12 +45,11 @@ src_io_chain_libio_chain_la_SOURCES = src/io-chain/prepare-read-op.c \
src_client_libmobject_store_la_SOURCES
=
\
src/client/aio/completion.c
\
src/client/io-context.c
\
src/client/omap-iter.c
\
src/client/cluster.c
\
src/client/read-op.c
\
src/client/write-op.c
\
src/client/libmobject-store.c
src/client/omap-iter.c
\
src/client/aio/completion.c
src_client_libmobject_store_la_CPPFLAGS
=
${
AM_CPPFLAGS
}
${
CLIENT_CPPFLAGS
}
src_client_libmobject_store_la_LIBADD
=
src/omap-iter/libomap-iter.la
\
src/io-chain/libio-chain.la
${
CLIENT_LIBS
}
...
...
src/client/
libmobject-store
.c
→
src/client/
cluster
.c
View file @
336b01ae
...
...
@@ -14,16 +14,12 @@
#include <ssg.h>
#include "libmobject-store.h"
#include "src/util/log.h"
#include "src/client/cluster.h"
#include "src/io-chain/prepare-write-op.h"
#include "src/io-chain/prepare-read-op.h"
#include "src/rpc-types/write-op.h"
#include "src/rpc-types/read-op.h"
#include "src/rpc-types/read-op.h"
#include "src/client/io-context.h"
#include "src/io-chain/prepare-read-op.h"
#include "src/io-chain/prepare-write-op.h"
#include "src/client/cluster-handle.h"
#define MOBJECT_CLUSTER_FILE_ENV "MOBJECT_CLUSTER_FILE"
#include "src/util/log.h"
// global variables for RPC ids
...
...
@@ -32,18 +28,18 @@ hg_id_t mobject_read_op_rpc_id;
hg_id_t
mobject_shutdown_rpc_id
;
static
void
mobject_store_register
(
margo_instance_id
mid
);
static
int
mobject_store_shutdown_servers
(
mobject_store_handle_t
*
cluster_handle
);
static
int
mobject_store_shutdown_servers
(
struct
mobject_store_handle
*
cluster_handle
);
int
mobject_store_create
(
mobject_store_t
*
cluster
,
const
char
*
const
id
)
{
mobject_store_handle_t
*
cluster_handle
;
struct
mobject_store_handle
*
cluster_handle
;
char
*
cluster_file
;
int
ret
;
(
void
)
id
;
/* XXX: id unused in mobject */
/* allocate a new cluster handle and set some fields */
cluster_handle
=
(
mobject_store_handle_t
*
)
calloc
(
1
,
sizeof
(
*
cluster_handle
));
cluster_handle
=
(
struct
mobject_store_handle
*
)
calloc
(
1
,
sizeof
(
*
cluster_handle
));
if
(
!
cluster_handle
)
return
-
1
;
...
...
@@ -75,12 +71,15 @@ int mobject_store_create(mobject_store_t *cluster, const char * const id)
int
mobject_store_connect
(
mobject_store_t
cluster
)
{
mobject_store_handle_t
*
cluster_handle
=
(
mobject_store_handle_t
*
)
cluster
;
struct
mobject_store_handle
*
cluster_handle
;
char
*
svr_addr_str
;
char
proto
[
24
]
=
{
0
};
int
i
;
int
ret
;
cluster_handle
=
(
struct
mobject_store_handle
*
)
cluster
;
assert
(
cluster_handle
);
if
(
cluster_handle
->
connected
)
return
0
;
...
...
@@ -95,7 +94,7 @@ int mobject_store_connect(mobject_store_t cluster)
free
(
cluster_handle
);
return
-
1
;
}
/* we only need to the proto portion of the address to initialize */
/* we only need to
get
the proto portion of the address to initialize */
for
(
i
=
0
;
i
<
24
&&
svr_addr_str
[
i
]
!=
'\0'
&&
svr_addr_str
[
i
]
!=
':'
;
i
++
)
proto
[
i
]
=
svr_addr_str
[
i
];
...
...
@@ -148,11 +147,11 @@ int mobject_store_connect(mobject_store_t cluster)
void
mobject_store_shutdown
(
mobject_store_t
cluster
)
{
mobject_store_handle_t
*
cluster_handle
=
(
mobject_store_handle_t
*
)
cluster
;
struct
mobject_store_handle
*
cluster_handle
;
char
*
svr_kill_env_str
;
int
ret
;
cluster_handle
=
(
struct
mobject_store_handle
*
)
cluster
;
assert
(
cluster_handle
!=
NULL
);
if
(
!
cluster_handle
->
connected
)
...
...
@@ -179,6 +178,23 @@ void mobject_store_shutdown(mobject_store_t cluster)
return
;
}
int
mobject_store_ioctx_create
(
mobject_store_t
cluster
,
const
char
*
pool_name
,
mobject_store_ioctx_t
*
ioctx
)
{
*
ioctx
=
(
mobject_store_ioctx_t
)
calloc
(
1
,
sizeof
(
**
ioctx
));
(
*
ioctx
)
->
pool_name
=
strdup
(
pool_name
);
(
*
ioctx
)
->
cluster
=
cluster
;
return
0
;
}
void
mobject_store_ioctx_destroy
(
mobject_store_ioctx_t
ioctx
)
{
if
(
ioctx
)
free
(
ioctx
->
pool_name
);
free
(
ioctx
);
}
int
mobject_store_write_op_operate
(
mobject_store_write_op_t
write_op
,
mobject_store_ioctx_t
io
,
const
char
*
oid
,
...
...
@@ -269,7 +285,7 @@ static void mobject_store_register(margo_instance_id mid)
}
// send a shutdown signal to a server cluster
static
int
mobject_store_shutdown_servers
(
mobject_store_handle_t
*
cluster_handle
)
static
int
mobject_store_shutdown_servers
(
struct
mobject_store_handle
*
cluster_handle
)
{
hg_addr_t
svr_addr
;
hg_handle_t
h
;
...
...
src/client/cluster
-handle
.h
→
src/client/cluster.h
View file @
336b01ae
...
...
@@ -3,17 +3,26 @@
*
* See COPYRIGHT in top-level directory.
*/
#ifndef __
MOBJECT_STORE_HANDLE
_H
#define __
MOBJECT_STORE_HANDLE
_H
#ifndef __
CLUSTER
_H
#define __
CLUSTER
_H
#include <margo.h>
#include <ssg.h>
#include "libmobject-store.h"
typedef
struct
mobject_store_handle
#define MOBJECT_CLUSTER_FILE_ENV "MOBJECT_CLUSTER_FILE"
struct
mobject_store_handle
{
margo_instance_id
mid
;
ssg_group_id_t
gid
;
int
connected
;
}
mobject_store_handle_t
;
};
struct
mobject_store_ioctx
{
mobject_store_t
cluster
;
char
*
pool_name
;
};
#endif
src/client/io-context.c
deleted
100644 → 0
View file @
d1632836
/*
* (C) 2017 The University of Chicago
*
* See COPYRIGHT in top-level directory.
*/
#include "libmobject-store.h"
#include "src/client/io-context.h"
#include "src/client/cluster-handle.h"
int
mobject_store_ioctx_create
(
mobject_store_t
cluster
,
const
char
*
pool_name
,
mobject_store_ioctx_t
*
ioctx
)
{
(
void
)
pool_name
;
/* XXX pool is ignored for now and instead use one global "pool" */
*
ioctx
=
(
mobject_store_ioctx_t
)
calloc
(
1
,
sizeof
(
**
ioctx
));
(
*
ioctx
)
->
pool_name
=
strdup
(
pool_name
);
(
*
ioctx
)
->
cluster
=
cluster
;
return
0
;
}
void
mobject_store_ioctx_destroy
(
mobject_store_ioctx_t
ioctx
)
{
if
(
ioctx
)
free
(
ioctx
->
pool_name
);
free
(
ioctx
);
}
src/client/io-context.h
deleted
100644 → 0
View file @
d1632836
/*
* (C) 2017 The University of Chicago
*
* See COPYRIGHT in top-level directory.
*/
#ifndef __MOBJECT_IOCTX_H
#define __MOBJECT_IOCTX_H
#include <margo.h>
#include "mobject-store-config.h"
#include "libmobject-store.h"
typedef
struct
mobject_ioctx
{
mobject_store_t
cluster
;
char
*
pool_name
;
}
*
mobject_store_ioctx_t
;
#endif
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