This source file includes following definitions.
- ds12_init
- ds12_finalize
- ds12_assign_module
- ds12_cache_job_info
- ds12_register_job_info
- ds12_store_job_info
- ds12_store
- ds12_store_modex
- ds12_fetch
- ds12_setup_fork
- ds12_add_nspace
- ds12_del_nspace
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #include <src/include/pmix_config.h>
17 #include <pmix_common.h>
18 #include "src/include/pmix_globals.h"
19 #include "src/util/error.h"
20 #include "src/mca/gds/base/base.h"
21 #include "src/util/argv.h"
22
23 #include "src/mca/common/dstore/dstore_common.h"
24 #include "gds_ds12_base.h"
25 #include "gds_ds12_lock.h"
26 #include "gds_ds12_file.h"
27 #include "src/mca/common/dstore/dstore_base.h"
28
29 static pmix_common_dstore_ctx_t *ds12_ctx;
30
31 static pmix_status_t ds12_init(pmix_info_t info[], size_t ninfo)
32 {
33 pmix_status_t rc = PMIX_SUCCESS;
34 pmix_common_dstore_file_cbs_t *dstore_file_cbs = NULL;
35
36 if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
37 dstore_file_cbs = &pmix_ds20_file_module;
38 }
39 ds12_ctx = pmix_common_dstor_init("ds12", info, ninfo,
40 &pmix_ds12_lock_module,
41 dstore_file_cbs);
42 if (NULL == ds12_ctx) {
43 rc = PMIX_ERR_INIT;
44 }
45
46 return rc;
47 }
48
49 static void ds12_finalize(void)
50 {
51 pmix_common_dstor_finalize(ds12_ctx);
52 }
53
54 static pmix_status_t ds12_assign_module(pmix_info_t *info, size_t ninfo,
55 int *priority)
56 {
57 size_t n, m;
58 char **options;
59
60 *priority = 20;
61 if (NULL != info) {
62 for (n=0; n < ninfo; n++) {
63 if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) {
64 options = pmix_argv_split(info[n].value.data.string, ',');
65 for (m=0; NULL != options[m]; m++) {
66 if (0 == strcmp(options[m], "ds12")) {
67
68 *priority = 100;
69 break;
70 }
71 if (0 == strcmp(options[m], "dstore")) {
72
73
74
75 *priority = 50;
76 break;
77 }
78 }
79 pmix_argv_free(options);
80 break;
81 }
82 }
83 }
84
85 return PMIX_SUCCESS;
86 }
87
88 static pmix_status_t ds12_cache_job_info(struct pmix_namespace_t *ns,
89 pmix_info_t info[], size_t ninfo)
90 {
91 return PMIX_SUCCESS;
92 }
93
94 static pmix_status_t ds12_register_job_info(struct pmix_peer_t *pr,
95 pmix_buffer_t *reply)
96 {
97 if (PMIX_PROC_IS_V1(pr)) {
98 ds12_ctx->file_cbs = &pmix_ds12_file_module;
99 } else {
100 ds12_ctx->file_cbs = &pmix_ds20_file_module;
101 }
102 return pmix_common_dstor_register_job_info(ds12_ctx, pr, reply);
103 }
104
105 static pmix_status_t ds12_store_job_info(const char *nspace, pmix_buffer_t *buf)
106 {
107 return pmix_common_dstor_store_job_info(ds12_ctx, nspace, buf);
108 }
109
110 static pmix_status_t ds12_store(const pmix_proc_t *proc,
111 pmix_scope_t scope,
112 pmix_kval_t *kv)
113 {
114 return pmix_common_dstor_store(ds12_ctx, proc, scope, kv);
115 }
116
117
118
119
120
121 static pmix_status_t ds12_store_modex(struct pmix_namespace_t *nspace,
122 pmix_buffer_t *buf,
123 void *cbdata)
124 {
125 return pmix_common_dstor_store_modex(ds12_ctx, nspace, buf, cbdata);
126 }
127
128 static pmix_status_t ds12_fetch(const pmix_proc_t *proc,
129 pmix_scope_t scope, bool copy,
130 const char *key,
131 pmix_info_t info[], size_t ninfo,
132 pmix_list_t *kvs)
133 {
134 return pmix_common_dstor_fetch(ds12_ctx, proc, scope, copy, key, info, ninfo, kvs);
135 }
136
137 static pmix_status_t ds12_setup_fork(const pmix_proc_t *peer, char ***env)
138 {
139 return pmix_common_dstor_setup_fork(ds12_ctx, PMIX_DSTORE_ESH_BASE_PATH, peer, env);
140 }
141
142 static pmix_status_t ds12_add_nspace(const char *nspace,
143 pmix_info_t info[],
144 size_t ninfo)
145 {
146 return pmix_common_dstor_add_nspace(ds12_ctx, nspace, info, ninfo);
147 }
148
149 static pmix_status_t ds12_del_nspace(const char* nspace)
150 {
151 return pmix_common_dstor_del_nspace(ds12_ctx, nspace);
152 }
153
154 pmix_gds_base_module_t pmix_ds12_module = {
155 .name = "ds12",
156 .is_tsafe = false,
157 .init = ds12_init,
158 .finalize = ds12_finalize,
159 .assign_module = ds12_assign_module,
160 .cache_job_info = ds12_cache_job_info,
161 .register_job_info = ds12_register_job_info,
162 .store_job_info = ds12_store_job_info,
163 .store = ds12_store,
164 .store_modex = ds12_store_modex,
165 .fetch = ds12_fetch,
166 .setup_fork = ds12_setup_fork,
167 .add_nspace = ds12_add_nspace,
168 .del_nspace = ds12_del_nspace,
169 };
170