Motr  M0
idx.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT
24 #include "lib/trace.h" /* M0_LOG */
25 
26 #include "ut/ut.h" /* M0_UT_ASSERT */
27 #include "motr/ut/client.h"
28 
29 #include "lib/finject.h"
30 /*
31  * Including the c files so we can replace the M0_PRE asserts
32  * in order to test them.
33  */
34 #include "motr/idx.c"
35 
37 
38 static struct m0_client *dummy_instance;
39 
40 static struct m0_op_idx* ut_m0_op_idx_alloc()
41 {
42  struct m0_op_idx *oi;
43 
44  M0_ALLOC_PTR(oi);
45  M0_UT_ASSERT(oi != NULL);
46  M0_SET0(oi);
47 
48  oi->oi_oc.oc_op.op_size = sizeof *oi;
50  m0_op_idx_bob_init(oi);
51  m0_ast_rc_bob_init(&oi->oi_ar);
52  m0_op_common_bob_init(&oi->oi_oc);
53 
54  return oi;
55 }
56 
57 static void ut_m0_op_idx_free(struct m0_op_idx *oi)
58 {
59  m0_free(oi);
60 }
61 
65 static void ut__idx_op_invariant(void)
66 {
67  bool rc;
68  struct m0_op_idx *oi;
69 
70  /* Base cases. */
71  oi = ut_m0_op_idx_alloc();
73  M0_UT_ASSERT(rc == true);
74 
76  M0_UT_ASSERT(rc == false);
77 
78  oi->oi_oc.oc_op.op_size = sizeof *oi - 1;
80  M0_UT_ASSERT(rc == false);
81 
83 }
84 
88 static void ut_idx_op_init(void)
89 {
90  int rc = 0; /* required */
91  struct m0_realm realm;
92  struct m0_idx idx;
93  struct m0_op *op = NULL;
94  struct m0_client *instance = NULL;
95  struct m0_uint128 id;
96 
97  /* initialise */
100 
101  /* base case */
102  id = M0_ID_APP;
103  id.u_lo++;
104  idx.in_entity.en_id = id;
105 
106  op = m0_alloc(sizeof(struct m0_op_idx));
107  op->op_size = sizeof(struct m0_op_idx);
108 
109  /* ADD FI here */
110  m0_fi_enable_once("m0_op_init", "fail_op_init");
111  rc = idx_op_init(&idx, M0_EO_CREATE,
112  NULL, NULL, NULL, 0, op);
113  M0_UT_ASSERT(rc != 0);
114 
115  rc = idx_op_init(&idx, M0_EO_CREATE,
116  NULL, NULL, NULL, 0, op);
117  M0_UT_ASSERT(rc == 0);
118  M0_UT_ASSERT(op->op_code == M0_EO_CREATE);
119  m0_free(op);
120 
121  /* finalise */
123 }
124 
128 static void ut_idx_op_complete(void)
129 {
130  struct m0_entity ent;
131  struct m0_realm realm;
132  struct m0_client *instance = NULL;
133  struct m0_op_idx *oi;
134  struct m0_sm_group *op_grp;
135  struct m0_sm_group *en_grp;
136  struct m0_sm_group oi_grp;
137 
138  /* init */
139  M0_SET0(&ent);
142 
143  oi = ut_m0_op_idx_alloc();
144  oi->oi_oc.oc_op.op_entity = &ent;
146  m0_op_bob_init(&oi->oi_oc.oc_op);
147 
148  m0_sm_group_init(&oi_grp);
149  oi->oi_sm_grp = &oi_grp;
150 
151  en_grp = &ent.en_sm_group;
152  op_grp = &oi->oi_oc.oc_op.op_sm_group;
153  m0_sm_group_init(en_grp);
154  m0_sm_group_init(op_grp);
155 
156  /* base case */
158  M0_OS_INITIALISED, op_grp);
159 
160  m0_sm_group_lock(en_grp);
161  m0_sm_move(&ent.en_sm, 0, M0_ES_CREATING);
162  m0_sm_group_unlock(en_grp);
163 
164  m0_sm_group_lock(op_grp);
166  m0_sm_group_unlock(op_grp);
167 
168  m0_fi_enable_once("m0_op_stable", "skip_ongoing_io_ref");
169  m0_sm_group_lock(&oi_grp);
170  idx_op_ast_complete(&oi_grp, &oi->oi_ar.ar_ast);
171  m0_sm_group_unlock(&oi_grp);
172 
173  M0_UT_ASSERT(ent.en_sm.sm_state == M0_ES_OPEN);
175 
176  /* finalise */
177  m0_sm_group_fini(&oi_grp);
178  m0_sm_group_lock(op_grp);
179  m0_sm_fini(&oi->oi_oc.oc_op.op_sm);
180  m0_sm_group_unlock(op_grp);
181  m0_sm_group_fini(op_grp);
182 
184  ut_m0_op_idx_free(oi);
185 }
186 
190 static void ut_idx_op_fail(void)
191 {
192  struct m0_entity ent;
193  struct m0_realm realm;
194  struct m0_client *instance = NULL;
195  struct m0_op_idx *oi;
196  struct m0_sm_group oi_grp;
197  struct m0_sm_group *op_grp;
198  struct m0_sm_group *en_grp;
199 
200  /* init */
201  M0_SET0(&ent);
204 
205  oi = ut_m0_op_idx_alloc();
206  oi->oi_oc.oc_op.op_entity = &ent;
208  m0_op_bob_init(&oi->oi_oc.oc_op);
209 
210  m0_sm_group_init(&oi_grp);
211  oi->oi_sm_grp = &oi_grp;
212 
213  en_grp = &ent.en_sm_group;
214  op_grp = &oi->oi_oc.oc_op.op_sm_group;
215  m0_sm_group_init(en_grp);
216  m0_sm_group_init(op_grp);
217 
218  /* base case */
220  M0_OS_INITIALISED, op_grp);
221 
222  m0_sm_group_lock(en_grp);
223  m0_sm_move(&ent.en_sm, 0, M0_ES_CREATING);
224  m0_sm_group_unlock(en_grp);
225 
226  m0_sm_group_lock(op_grp);
228  m0_sm_group_unlock(op_grp);
229 
230  m0_sm_group_lock(&oi_grp);
231  m0_fi_enable_once("m0_op_stable", "skip_ongoing_io_ref");
232  idx_op_fail(oi, -1);
233  m0_sm_group_unlock(&oi_grp);
234 
235  M0_UT_ASSERT(ent.en_sm.sm_state == M0_ES_OPEN);
236  M0_UT_ASSERT(oi->oi_oc.oc_op.op_rc == -1);
238 
239  /* finalise */
240  m0_sm_group_fini(&oi_grp);
241  m0_sm_group_lock(op_grp);
242  m0_sm_fini(&oi->oi_oc.oc_op.op_sm);
243  m0_sm_group_unlock(op_grp);
244  m0_sm_group_fini(op_grp);
245 
247  ut_m0_op_idx_free(oi);
248 }
249 
253 static int dummy_query_rc = 1;
254 
255 static int idx_dummy_query(struct m0_op_idx *oi)
256 {
257  return dummy_query_rc;
258 }
259 
262  .iqo_namei_delete = idx_dummy_query,
263  .iqo_namei_lookup = idx_dummy_query,
264  .iqo_namei_list = idx_dummy_query,
265 
266  .iqo_get = idx_dummy_query,
267  .iqo_put = idx_dummy_query,
268  .iqo_del = idx_dummy_query,
269  .iqo_next = idx_dummy_query,
270 };
272 
273 static void ut_idx_op_cb_launch(void)
274 {
275  int op_code;
276  struct m0_client *instance = NULL;
277  struct m0_realm realm;
278  struct m0_sm_group *op_grp;
279  struct m0_sm_group *en_grp;
280  struct m0_sm_group locality_grp;
281  struct m0_entity ent;
282  struct m0_op_idx *oi;
283 
284  /* Initialise client */
285  M0_SET0(&ent);
288 
289  oi = ut_m0_op_idx_alloc();
290  oi->oi_oc.oc_op.op_entity = &ent;
292  m0_op_bob_init(&oi->oi_oc.oc_op);
293 
294  op_grp = &oi->oi_oc.oc_op.op_sm_group;
295  en_grp = &ent.en_sm_group;
296  m0_sm_group_init(op_grp);
297  m0_sm_group_init(en_grp);
298  m0_sm_group_init(&locality_grp);
299  oi->oi_sm_grp = &locality_grp;
300 
302  instance->m0c_idx_svc_ctx.isc_service = &idx_dummy_service;
303 
304  /* Base case 1: asynchronous queries */
305  for (op_code = M0_EO_CREATE;
306  op_code <= M0_EO_DELETE; op_code++) {
307  /* Ignore SYNC. */
308  if (M0_IN(op_code, (M0_EO_SYNC, M0_EO_OPEN,
309  M0_EO_GETATTR)))
310  continue;
311 
312  dummy_query_rc = 1;
313  oi->oi_oc.oc_op.op_code = op_code;
315  M0_OS_INITIALISED, op_grp);
316 
317  m0_sm_group_lock(op_grp);
318  idx_op_cb_launch(&oi->oi_oc);
321  m0_sm_fini(&oi->oi_oc.oc_op.op_sm);
322  m0_sm_group_unlock(op_grp);
323 
324  m0_sm_group_lock(en_grp);
325  if (op_code == M0_EO_CREATE)
326  m0_sm_move(&ent.en_sm, 0, M0_ES_OPEN);
327  else
328  m0_sm_move(&ent.en_sm, 0, M0_ES_INIT);
329  m0_sm_group_unlock(en_grp);
330 
331  }
332 
333  for (op_code = M0_IC_GET;
334  op_code <= M0_IC_NEXT; op_code++) {
335  dummy_query_rc = 1;
336  oi->oi_oc.oc_op.op_code = op_code;
338  M0_OS_INITIALISED, op_grp);
339 
340  m0_sm_group_lock(op_grp);
341  idx_op_cb_launch(&oi->oi_oc);
344  m0_sm_fini(&oi->oi_oc.oc_op.op_sm);
345  m0_sm_group_unlock(op_grp);
346 
347  }
348 
349  /* Case 2 and 3 are delayed until we find a way to start locality thread.*/
350  /* Base case 2: sync query successes. */
351  /* Base case 3: sync query fails. */
352 
353  /* finalise */
354  m0_sm_group_fini(&locality_grp);
355  m0_sm_group_fini(op_grp);
356 
358  ut_m0_op_idx_free(oi);
359 }
360 
364 static void ut_idx_op_cb_free(void)
365 {
366  struct m0_op_idx *oi;
367  struct m0_entity ent;
368  struct m0_realm realm;
369  struct m0_client *instance = NULL;
370 
371  /* init */
372  M0_SET0(&ent);
375 
376  /* base case */
377  oi = ut_m0_op_idx_alloc();
378  oi->oi_oc.oc_op.op_entity = &ent;
379  idx_op_cb_free(&oi->oi_oc);
380 
381  /* fini */
383 }
384 
388 static void ut_idx_op_cb_fini(void)
389 {
390  struct m0_op_idx *oi;
391  struct m0_realm realm;
392  struct m0_entity ent;
393  struct m0_client *instance = NULL;
394 
395  /* init */
396  M0_SET0(&ent);
399 
400  /* base cases */
401  oi = ut_m0_op_idx_alloc();
402  oi->oi_oc.oc_op.op_entity = &ent;
403  idx_op_cb_fini(&oi->oi_oc);
404 
405  /* fini */
407  ut_m0_op_idx_free(oi);
408 }
409 
413 static void ut_idx_op_ast_complete(void)
414 {
415  struct m0_client *instance = NULL;
416  struct m0_realm realm;
417  struct m0_sm_group *op_grp;
418  struct m0_sm_group *en_grp;
419  struct m0_sm_group locality_grp;
420  struct m0_entity ent;
421  struct m0_op_idx oi;
422 
423  /* initialise client */
425  M0_SET0(&ent);
426  M0_SET0(&oi);
427  M0_SET0(&realm);
428  m0_op_bob_init(&oi.oi_oc.oc_op);
429  m0_ast_rc_bob_init(&oi.oi_ar);
430  m0_op_idx_bob_init(&oi);
431 
433  op_grp = &oi.oi_oc.oc_op.op_sm_group;
434  en_grp = &ent.en_sm_group;
435  m0_sm_group_init(op_grp);
436  m0_sm_group_init(en_grp);
437  m0_sm_group_init(&locality_grp);
438  oi.oi_sm_grp = &locality_grp;
439 
440  /* base case: one single ios cob request */
441  oi.oi_oc.oc_op.op_entity = &ent;
442  oi.oi_oc.oc_op.op_size = sizeof oi;
444 
446  M0_OS_INITIALISED, op_grp);
447  m0_sm_group_lock(en_grp);
448  m0_sm_move(&ent.en_sm, 0, M0_ES_CREATING);
449  m0_sm_group_unlock(en_grp);
450 
451  m0_sm_group_lock(op_grp);
453  m0_sm_group_unlock(op_grp);
454 
455  m0_fi_enable_once("m0_op_stable", "skip_ongoing_io_ref");
456  m0_sm_group_lock(&locality_grp);
457  idx_op_ast_complete(&locality_grp, &oi.oi_ar.ar_ast);
458  m0_sm_group_unlock(&locality_grp);
459 
461  M0_UT_ASSERT(ent.en_sm.sm_state == M0_ES_OPEN);
463 
464  /* finalise */
465  m0_op_bob_fini(&oi.oi_oc.oc_op);
466 
467  m0_sm_group_lock(op_grp);
469  m0_sm_group_unlock(op_grp);
470 
471  m0_sm_group_fini(&locality_grp);
472  m0_sm_group_fini(op_grp);
474 }
475 
479 static void ut_idx_op_ast_fail(void)
480 {
481  struct m0_client *instance = NULL;
482  struct m0_realm realm;
483  struct m0_sm_group *op_grp;
484  struct m0_sm_group *en_grp;
485  struct m0_sm_group locality_grp;
486  struct m0_entity ent;
487  struct m0_op_idx oi;
488 
489  /* initialise client */
491  M0_SET0(&ent);
492  M0_SET0(&oi);
493  M0_SET0(&realm);
494  m0_op_bob_init(&oi.oi_oc.oc_op);
495  m0_ast_rc_bob_init(&oi.oi_ar);
496  m0_op_idx_bob_init(&oi);
497 
499  op_grp = &oi.oi_oc.oc_op.op_sm_group;
500  en_grp = &ent.en_sm_group;
501  m0_sm_group_init(op_grp);
502  m0_sm_group_init(en_grp);
503  m0_sm_group_init(&locality_grp);
504  oi.oi_sm_grp = &locality_grp;
505 
506  /* base case: one single ios cob request */
507  oi.oi_oc.oc_op.op_entity = &ent;
508  oi.oi_oc.oc_op.op_size = sizeof oi;
510  oi.oi_ar.ar_rc = -1;
511 
513  M0_OS_INITIALISED, op_grp);
514  m0_sm_group_lock(en_grp);
515  m0_sm_move(&ent.en_sm, 0, M0_ES_CREATING);
516  m0_sm_group_unlock(en_grp);
517 
518  m0_sm_group_lock(op_grp);
520  m0_sm_group_unlock(op_grp);
521 
522  m0_fi_enable_once("m0_op_stable", "skip_ongoing_io_ref");
523  m0_sm_group_lock(&locality_grp);
524  idx_op_ast_fail(&locality_grp, &oi.oi_ar.ar_ast);
525  m0_sm_group_unlock(&locality_grp);
526 
528  M0_UT_ASSERT(ent.en_sm.sm_state == M0_ES_OPEN);
529  M0_UT_ASSERT(oi.oi_oc.oc_op.op_rc == -1);
531 
532  /* finalise */
533  m0_op_bob_fini(&oi.oi_oc.oc_op);
534 
535  m0_sm_group_lock(op_grp);
537  m0_sm_group_unlock(op_grp);
538 
539  m0_sm_group_fini(&locality_grp);
540  m0_sm_group_fini(op_grp);
542 }
543 
550 static void ut_m0_idx_init(void)
551 {
552  struct m0_idx idx;
553  struct m0_uint128 id;
554  struct m0_client *instance = NULL;
555  struct m0_container uber_realm;
556 
557  /* initialise client */
560  &M0_UBER_REALM,
561  instance);
562 
563  /* we need a valid id */
564  id = M0_ID_APP;
565  id.u_lo++;
566 
567  /* base case: no error */
568  m0_idx_init(&idx, &uber_realm.co_realm, &id);
569 
570  /* check the initialisation */
572  M0_UT_ASSERT(m0_uint128_cmp(&idx.in_entity.en_id, &id) == 0);
573  M0_UT_ASSERT(idx.in_entity.en_realm == &uber_realm.co_realm);
574 }
575 
579 static void ut_m0_idx_fini(void)
580 {
581  struct m0_uint128 id;
582  struct m0_idx idx;
583  struct m0_client *instance = NULL;
584  struct m0_container uber_realm;
585 
586  /* initialise client */
589  &M0_UBER_REALM,
590  instance);
591 
592  /* Create an entity we can use */
593  id = M0_ID_APP;
594  id.u_lo++;
595  m0_idx_init(&idx, &uber_realm.co_realm, &id);
596 
597  /* Base case: m0_idx_fini works */
598  m0_idx_fini(&idx);
599 }
600 
604 static void ut_m0_idx_op(void)
605 {
606  int rc = 0; /* required */
607  struct m0_op *op = NULL;
608  struct m0_idx idx;
609  struct m0_uint128 id;
610  struct m0_client *instance = NULL;
611  struct m0_realm realm;
612  struct m0_bufvec keys;
613  struct m0_bufvec vals;
614  int rcs;
615 
618 
619  id = M0_ID_APP;
620  id.u_lo++;
621  idx.in_entity.en_id = id;
622 
623  /* Base case */
624  keys.ov_vec.v_nr = 0x01;
625  vals.ov_vec.v_nr = 0x01;
626  rc = m0_idx_op(&idx, M0_IC_GET, &keys, &vals, &rcs, 0,
627  &op);
628  M0_UT_ASSERT(rc == 0);
629  M0_UT_ASSERT(op != NULL);
630  m0_free(op);
631 
633 }
634 
638 static void ut_m0_idx_op_namei(void)
639 {
640  int rc = 0; /* required */
641  struct m0_op *op = NULL;
642  struct m0_idx idx;
643  struct m0_uint128 id;
644  struct m0_client *instance = NULL;
645  struct m0_realm realm;
646 
649 
650  id = M0_ID_APP;
651  id.u_lo++;
652  idx.in_entity.en_id = id;
653 
654  /* Base case */
656  M0_UT_ASSERT(rc == 0);
657  M0_UT_ASSERT(op != NULL);
658  m0_free(op);
659 
661 }
662 
666 static void ut_m0_idx_service_config(void)
667 {
668  int svc_id = 0;
670 
671  m0_idx_service_config(instance, svc_id, (void *)0x100);
672 }
673 
674 M0_INTERNAL int ut_idx_init(void)
675 {
676  int rc;
677 
679  M0_UT_ASSERT(rc == 0);
680 
681  return 0;
682 }
683 
684 M0_INTERNAL int ut_idx_fini(void)
685 {
687 
688  return 0;
689 }
690 struct m0_ut_suite ut_suite_idx = {
691  .ts_name = "idx-ut",
692  .ts_init = ut_idx_init,
693  .ts_fini = ut_idx_fini,
694  .ts_tests = {
695  { "_idx_op_invariant",
697  { "idx_op_init",
698  &ut_idx_op_init},
699  { "idx_op_complete",
701  { "idx_op_fail",
702  &ut_idx_op_fail},
703  { "idx_op_cb_launch",
705  { "idx_op_cb_free",
707  { "idx_op_cb_fini",
709  { "idx_op_ast_complete",
711  { "idx_op_ast_fail",
713  { "m0_idx_init",
714  &ut_m0_idx_init},
715  { "m0_idx_fini",
716  &ut_m0_idx_fini},
717  { "m0_idx_op",
718  &ut_m0_idx_op},
719  { "m0_idx_op_namei",
721  { "m0_idx_service_config",
723  { NULL, NULL },
724  }
725 };
726 
727 #undef M0_TRACE_SUBSYSTEM
728 
729 /*
730  * Local variables:
731  * c-indentation-style: "K&R"
732  * c-basic-offset: 8
733  * tab-width: 8
734  * fill-column: 80
735  * scroll-step: 1
736  * End:
737  */
M0_INTERNAL int m0_uint128_cmp(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
Definition: misc.c:45
uint64_t id
Definition: cob.h:2380
static int dummy_query_rc
Definition: idx.c:253
Definition: client.h:835
void m0_entity_fini(struct m0_entity *entity)
Definition: client.c:438
#define NULL
Definition: misc.h:38
static void idx_op_cb_fini(struct m0_op_common *oc)
Definition: idx.c:391
static void ut_idx_op_complete(void)
Definition: idx.c:128
M0_INTERNAL void idx_op_ast_complete(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:311
M0_INTERNAL void idx_op_ast_fail(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: idx.c:367
M0_INTERNAL void m0_idx_service_config(struct m0_client *m0c, int svc_id, void *svc_conf)
Definition: idx.c:654
struct m0_vec ov_vec
Definition: vec.h:147
static struct m0_realm uber_realm
Definition: m0hsm.c:49
static void ut_m0_idx_init(void)
Definition: idx.c:550
static void ut_idx_op_ast_fail(void)
Definition: idx.c:479
struct m0_op oc_op
void m0_idx_fini(struct m0_idx *idx)
Definition: idx.c:643
#define M0_SET0(obj)
Definition: misc.h:64
Definition: ut.h:77
static void ut_idx_op_init(void)
Definition: idx.c:88
const struct m0_uint128 M0_UBER_REALM
Definition: client.c:85
struct m0_op_common oi_oc
static void ut_m0_idx_fini(void)
Definition: idx.c:579
M0_INTERNAL int ut_m0_client_init(struct m0_client **instance)
Definition: client.c:265
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
Definition: sm.c:65
const struct m0_uint128 M0_ID_APP
Definition: client.c:92
int m0_idx_op(struct m0_idx *idx, enum m0_idx_opcode opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op **op)
Definition: idx.c:554
op
Definition: libdemo.c:64
unsigned int op_code
Definition: client.h:650
struct m0_idx_query_ops * is_query_ops
Definition: idx.h:147
M0_INTERNAL int m0_idx_op_namei(struct m0_entity *entity, struct m0_op **op, enum m0_entity_opcode opcode)
Definition: idx.c:603
static void idx_op_cb_free(struct m0_op_common *oc)
Definition: idx.c:415
int(* iqo_namei_create)(struct m0_op_idx *oi)
Definition: idx.h:123
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
Definition: sm.c:96
struct m0_entity in_entity
Definition: client.h:836
size_t op_size
Definition: client.h:664
Definition: client.h:641
M0_INTERNAL void ut_realm_entity_setup(struct m0_realm *realm, struct m0_entity *ent, struct m0_client *cinst)
Definition: client.c:60
static void ut_m0_op_idx_free(struct m0_op_idx *oi)
Definition: idx.c:57
struct m0_sm op_sm
Definition: client.h:656
static void ut_idx_op_fail(void)
Definition: idx.c:190
M0_INTERNAL void ut_m0_client_fini(struct m0_client **instance)
Definition: client.c:354
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
Definition: sm.c:53
int32_t op_rc
Definition: client.h:652
static void idx_op_fail(struct m0_op_idx *oi, int rc)
Definition: idx.c:325
static struct m0_client * dummy_instance
Definition: idx.c:38
static void ut__idx_op_invariant(void)
Definition: idx.c:65
struct m0_ast_rc oi_ar
void * m0_alloc(size_t size)
Definition: memory.c:126
uint32_t v_nr
Definition: vec.h:51
M0_INTERNAL bool m0__idx_op_invariant(struct m0_op_idx *oi)
Definition: idx.c:74
static struct m0_op_idx * ut_m0_op_idx_alloc()
Definition: idx.c:40
struct m0_uint128 en_id
Definition: client.h:708
static void idx_op_cb_launch(struct m0_op_common *oc)
Definition: idx.c:471
struct m0_sm_ast ar_ast
const char * ts_name
Definition: ut.h:99
struct m0_sm_group * oi_sm_grp
struct m0_realm * en_realm
Definition: client.h:710
struct m0_ut_suite ut_suite_idx
Definition: idx.c:36
struct m0_sm_group op_sm_group
Definition: client.h:654
M0_INTERNAL void m0_sm_init(struct m0_sm *mach, const struct m0_sm_conf *conf, uint32_t state, struct m0_sm_group *grp)
Definition: sm.c:313
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
static struct m0_realm realm
Definition: sync.c:87
struct m0_entity * op_entity
Definition: client.h:660
M0_INTERNAL int ut_idx_init(void)
Definition: idx.c:674
static void ut_idx_op_cb_free(void)
Definition: idx.c:364
static struct m0_idx_query_ops idx_dummy_query_ops
Definition: idx.c:260
M0_INTERNAL void m0_sm_move(struct m0_sm *mach, int32_t rc, int state)
Definition: sm.c:485
static struct m0 instance
Definition: main.c:78
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
Definition: sm.c:83
static void m0_fi_enable_once(const char *func, const char *tag)
Definition: finject.h:301
static void ut_idx_op_cb_fini(void)
Definition: idx.c:388
void m0_container_init(struct m0_container *con, struct m0_realm *parent, const struct m0_uint128 *id, struct m0_client *instance)
Definition: realm.c:31
static void ut_idx_op_cb_launch(void)
Definition: idx.c:273
static void ut_m0_idx_op(void)
Definition: idx.c:604
static int idx_dummy_query(struct m0_op_idx *oi)
Definition: idx.c:255
static void ut_m0_idx_service_config(void)
Definition: idx.c:666
static struct m0_idx_service idx_dummy_service
Definition: idx.c:271
struct m0_dirent * ent
Definition: dir.c:1029
uint64_t u_lo
Definition: types.h:37
static int idx_op_init(struct m0_idx *idx, int opcode, struct m0_bufvec *keys, struct m0_bufvec *vals, int32_t *rcs, uint32_t flags, struct m0_op *op)
Definition: idx.c:165
void m0_free(void *data)
Definition: memory.c:146
uint32_t sm_state
Definition: sm.h:307
M0_INTERNAL int ut_idx_fini(void)
Definition: idx.c:684
int32_t rc
Definition: trigger_fop.h:47
static void ut_idx_op_ast_complete(void)
Definition: idx.c:413
enum m0_entity_type en_type
Definition: client.h:706
void m0_idx_init(struct m0_idx *idx, struct m0_realm *parent, const struct m0_uint128 *id)
Definition: idx.c:626
#define M0_UT_ASSERT(a)
Definition: ut.h:46
struct m0_sm_conf m0_op_conf
Definition: client.c:145
static void ut_m0_idx_op_namei(void)
Definition: idx.c:638
Definition: vec.h:145
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)
Definition: sm.c:331