Motr  M0
client.h
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 #pragma once
24 
25 #ifndef __MOTR_CAS_CLIENT_H__
26 #define __MOTR_CAS_CLIENT_H__
27 
28 #include "lib/time.h" /* m0_time_t */
29 #include "lib/chan.h" /* m0_chan */
30 #include "fid/fid.h" /* m0_fid */
31 #include "fop/fop.h" /* m0_fop */
32 #include "cas/cas.h" /* m0_cas_hint, m0_cas_id */
33 
34 /* Imports */
35 struct m0_dtx;
36 struct m0_bufvec;
37 struct m0_rpc_session;
38 
118 };
119 
123 struct m0_cas_req {
125  struct m0_sm ccr_sm;
126 
127  /* Private fields. */
128 
132  struct m0_fop *ccr_fop;
159  const struct m0_bufvec *ccr_keys;
164  uint64_t *ccr_asmbl_ikeys;
165  /* Returned tx REMID inforation from service to update FSYNC records. */
167 };
168 
176  int crr_rc;
186 };
187 
194  int clr_rc;
196  struct m0_fid clr_fid;
199 };
200 
205  int cge_rc;
207  struct m0_buf cge_val;
209  struct m0_crv cge_ver;
210 };
211 
217  int cnp_rc;
219  struct m0_buf cnp_key;
223  struct m0_buf cnp_val;
225  struct m0_crv cnp_ver;
226 };
227 
236 M0_INTERNAL void m0_cas_req_init(struct m0_cas_req *req,
237  struct m0_rpc_session *sess,
238  struct m0_sm_group *grp);
239 
253 M0_INTERNAL void m0_cas_req_fini(struct m0_cas_req *req);
254 
262 M0_INTERNAL void m0_cas_req_fini_lock(struct m0_cas_req *req);
263 
267 M0_INTERNAL void m0_cas_req_lock(struct m0_cas_req *req);
268 
272 M0_INTERNAL void m0_cas_req_unlock(struct m0_cas_req *req);
273 
277 M0_INTERNAL bool m0_cas_req_is_locked(const struct m0_cas_req *req);
278 
289 M0_INTERNAL int m0_cas_req_generic_rc(const struct m0_cas_req *req);
290 
304 M0_INTERNAL uint64_t m0_cas_req_nr(const struct m0_cas_req *req);
305 
315 M0_INTERNAL int m0_cas_req_wait(struct m0_cas_req *req, uint64_t states,
316  m0_time_t to);
317 
326 M0_INTERNAL int m0_cas_index_create(struct m0_cas_req *req,
327  const struct m0_cas_id *cids,
328  uint64_t cids_nr,
329  struct m0_dtx *dtx);
330 
336 M0_INTERNAL void m0_cas_index_create_rep(const struct m0_cas_req *req,
337  uint64_t idx,
338  struct m0_cas_rec_reply *rep);
339 
351 M0_INTERNAL int m0_cas_index_delete(struct m0_cas_req *req,
352  const struct m0_cas_id *cids,
353  uint64_t cids_nr,
354  struct m0_dtx *dtx,
355  uint32_t flags);
356 
362 M0_INTERNAL void m0_cas_index_delete_rep(const struct m0_cas_req *req,
363  uint64_t idx,
364  struct m0_cas_rec_reply *rep);
365 
374 M0_INTERNAL int m0_cas_index_lookup(struct m0_cas_req *req,
375  const struct m0_cas_id *cids,
376  uint64_t cids_nr);
377 
388 M0_INTERNAL void m0_cas_index_lookup_rep(const struct m0_cas_req *req,
389  uint64_t idx,
390  struct m0_cas_rec_reply *rep);
391 
404 M0_INTERNAL int m0_cas_index_list(struct m0_cas_req *req,
405  const struct m0_fid *start_fid,
406  uint32_t indices_nr,
407  uint32_t flags);
416 M0_INTERNAL void m0_cas_index_list_rep(struct m0_cas_req *req,
417  uint32_t idx,
418  struct m0_cas_ilist_reply *rep);
419 
435 M0_INTERNAL int m0_cas_put(struct m0_cas_req *req,
436  struct m0_cas_id *index,
437  const struct m0_bufvec *keys,
438  const struct m0_bufvec *values,
439  struct m0_dtx *dtx,
440  uint32_t flags);
441 
447 M0_INTERNAL void m0_cas_put_rep(struct m0_cas_req *req,
448  uint64_t idx,
449  struct m0_cas_rec_reply *rep);
450 
464 M0_INTERNAL void m0_cas_rep_mlock(const struct m0_cas_req *req,
465  uint64_t idx);
466 
476 M0_INTERNAL int m0_cas_get(struct m0_cas_req *req,
477  struct m0_cas_id *index,
478  const struct m0_bufvec *keys);
479 
489 M0_INTERNAL int m0_cas_versioned_get(struct m0_cas_req *req,
490  struct m0_cas_id *index,
491  const struct m0_bufvec *keys);
492 
501 M0_INTERNAL void m0_cas_get_rep(const struct m0_cas_req *req,
502  uint64_t idx,
503  struct m0_cas_get_reply *rep);
504 
528 M0_INTERNAL int m0_cas_next(struct m0_cas_req *req,
529  struct m0_cas_id *index,
530  struct m0_bufvec *start_keys,
531  uint32_t *recs_nr,
532  uint32_t flags);
533 
547 M0_INTERNAL void m0_cas_next_rep(const struct m0_cas_req *req,
548  uint32_t idx,
549  struct m0_cas_next_reply *rep);
550 
564 M0_INTERNAL int m0_cas_del(struct m0_cas_req *req,
565  struct m0_cas_id *index,
566  struct m0_bufvec *keys,
567  struct m0_dtx *dtx,
568  uint32_t flags);
569 
575 M0_INTERNAL void m0_cas_del_rep(struct m0_cas_req *req,
576  uint64_t idx,
577  struct m0_cas_rec_reply *rep);
578 
579 M0_INTERNAL int m0_cas_sm_conf_init(void);
580 M0_INTERNAL void m0_cas_sm_conf_fini(void);
581 
583 #endif /* __MOTR_CAS_CLIENT_H__ */
584 
585 /*
586  * Local variables:
587  * c-indentation-style: "K&R"
588  * c-basic-offset: 8
589  * tab-width: 8
590  * fill-column: 80
591  * scroll-step: 1
592  * End:
593  */
594 /*
595  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
596  */
M0_INTERNAL void m0_cas_req_fini(struct m0_cas_req *req)
Definition: client.c:288
struct m0_be_tx_remid ccr_remid
Definition: client.h:166
Definition: dtm.h:554
struct m0_rpc_session * ccr_sess
Definition: client.h:130
struct m0_cas_hint crr_hint
Definition: client.h:185
int const char const void size_t int flags
Definition: dir.c:328
struct m0_cas_rep ccr_reply
Definition: client.h:147
M0_INTERNAL int m0_cas_index_list(struct m0_cas_req *req, const struct m0_fid *start_fid, uint32_t indices_nr, uint32_t flags)
Definition: client.c:1435
struct m0_fid clr_fid
Definition: client.h:196
static struct io_request req
Definition: file.c:100
static struct m0_sm_group * grp
Definition: bytecount.c:38
uint64_t m0_time_t
Definition: time.h:37
M0_INTERNAL bool m0_cas_req_is_locked(const struct m0_cas_req *req)
Definition: client.c:235
M0_INTERNAL void m0_cas_get_rep(const struct m0_cas_req *req, uint64_t idx, struct m0_cas_get_reply *rep)
Definition: client.c:1755
const struct m0_bufvec * ccr_keys
Definition: client.h:159
M0_INTERNAL void m0_cas_index_create_rep(const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
Definition: client.c:1357
struct m0_fop_type * ccr_ftype
Definition: client.h:143
Definition: sm.h:504
struct m0_fop ccr_asmbl_fop
Definition: client.h:137
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
M0_INTERNAL int m0_cas_get(struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys)
Definition: client.c:1741
struct m0_buf cnp_val
Definition: client.h:223
M0_INTERNAL void m0_cas_req_unlock(struct m0_cas_req *req)
Definition: client.c:229
bool ccr_is_meta
Definition: client.h:145
M0_INTERNAL void m0_cas_req_lock(struct m0_cas_req *req)
Definition: client.c:223
struct m0_sm ccr_sm
Definition: client.h:125
Definition: buf.h:37
uint64_t ccr_sent_recs_nr
Definition: client.h:151
m0_cas_req_state
Definition: client.h:109
M0_INTERNAL int m0_cas_req_generic_rc(const struct m0_cas_req *req)
Definition: client.c:457
M0_INTERNAL void m0_cas_req_init(struct m0_cas_req *req, struct m0_rpc_session *sess, struct m0_sm_group *grp)
Definition: client.c:195
M0_INTERNAL void m0_cas_put_rep(struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
Definition: client.c:1685
M0_INTERNAL int m0_cas_next(struct m0_cas_req *req, struct m0_cas_id *index, struct m0_bufvec *start_keys, uint32_t *recs_nr, uint32_t flags)
Definition: client.c:1775
M0_INTERNAL int m0_cas_versioned_get(struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys)
Definition: client.c:1748
Definition: cas.h:157
M0_INTERNAL void m0_cas_next_rep(const struct m0_cas_req *req, uint32_t idx, struct m0_cas_next_reply *rep)
Definition: client.c:1825
struct m0_rpc_item * ccr_reply_item
Definition: client.h:153
M0_INTERNAL int m0_cas_sm_conf_init(void)
Definition: client.c:1883
M0_INTERNAL int m0_cas_del(struct m0_cas_req *req, struct m0_cas_id *index, struct m0_bufvec *keys, struct m0_dtx *dtx, uint32_t flags)
Definition: client.c:1842
struct m0_buf cge_val
Definition: client.h:207
struct m0_fop * ccr_fop
Definition: client.h:132
M0_INTERNAL int m0_cas_index_create(struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, struct m0_dtx *dtx)
Definition: client.c:1321
M0_INTERNAL void m0_cas_index_list_rep(struct m0_cas_req *req, uint32_t idx, struct m0_cas_ilist_reply *rep)
Definition: client.c:1488
struct m0_sm_ast ccr_failure_ast
Definition: client.h:157
Definition: cas.h:372
M0_INTERNAL int m0_cas_index_delete(struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr, struct m0_dtx *dtx, uint32_t flags)
Definition: client.c:1366
struct m0_cas_op * ccr_req_op
Definition: client.h:141
M0_INTERNAL void m0_cas_sm_conf_fini(void)
Definition: client.c:1891
struct m0_crv cge_ver
Definition: client.h:209
M0_INTERNAL void m0_cas_index_delete_rep(const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
Definition: client.c:1394
M0_INTERNAL void m0_cas_req_fini_lock(struct m0_cas_req *req)
Definition: client.c:295
M0_INTERNAL void m0_cas_del_rep(struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
Definition: client.c:1873
M0_INTERNAL uint64_t m0_cas_req_nr(const struct m0_cas_req *req)
Definition: client.c:1308
Definition: fid.h:38
M0_INTERNAL int m0_cas_index_lookup(struct m0_cas_req *req, const struct m0_cas_id *cids, uint64_t cids_nr)
Definition: client.c:1403
M0_INTERNAL int m0_cas_put(struct m0_cas_req *req, struct m0_cas_id *index, const struct m0_bufvec *keys, const struct m0_bufvec *values, struct m0_dtx *dtx, uint32_t flags)
Definition: client.c:1643
struct m0_sm_ast ccr_replied_ast
Definition: client.h:155
Definition: sm.h:301
M0_INTERNAL int m0_cas_req_wait(struct m0_cas_req *req, uint64_t states, m0_time_t to)
Definition: client.c:1313
struct m0_cas_hint clr_hint
Definition: client.h:198
M0_INTERNAL void m0_cas_rep_mlock(const struct m0_cas_req *req, uint64_t idx)
Definition: client.c:1816
struct m0_cas_recv ccr_rec_orig
Definition: client.h:149
Definition: cas.h:107
M0_INTERNAL void m0_cas_index_lookup_rep(const struct m0_cas_req *req, uint64_t idx, struct m0_cas_rec_reply *rep)
Definition: client.c:1426
struct m0_crv cnp_ver
Definition: client.h:225
struct m0_buf cnp_key
Definition: client.h:219
static struct m0_sm_state_descr states[C_NR]
Definition: sm.c:512
uint64_t * ccr_asmbl_ikeys
Definition: client.h:164
uint64_t ccr_max_replies_nr
Definition: client.h:139
Definition: fop.h:79
struct m0_cas_hint cnp_hint
Definition: client.h:221
Definition: vec.h:145