DAOS API (v2.0)
Loading...
Searching...
No Matches
daos_cont.h
Go to the documentation of this file.
1/*
2 * (C) Copyright 2020-2022 Intel Corporation.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause-Patent
5 */
12#ifndef __DAOS_CONT_H__
13#define __DAOS_CONT_H__
14
15#if defined(__cplusplus)
16extern "C" {
17#endif
18
19#include <daos_security.h>
20
34#define DAOS_COO_RO (1U << 0)
35#define DAOS_COO_RW (1U << 1)
36#define DAOS_COO_NOSLIP (1U << 2)
37#define DAOS_COO_FORCE (1U << 3)
38
39#define DAOS_COO_NBITS (4)
40#define DAOS_COO_MASK ((1U << DAOS_COO_NBITS) - 1)
41
43typedef struct {
45 uuid_t ci_uuid;
47 daos_epoch_t ci_lsnapshot;
49 uint32_t ci_redun_fac;
51 uint32_t ci_nsnapshots;
52 uint64_t ci_pad[2];
53 /* TODO: add more members, e.g., size, # objects, uid, gid... */
55
56
69d_rank_list_t *daos_rank_list_parse(const char *str, const char *sep);
70
91int
93
108int
110
111/*
112 * Container API
113 */
114
138int
139daos_cont_create(daos_handle_t poh, uuid_t *uuid, daos_prop_t *cont_prop, daos_event_t *ev);
140
165int
167 daos_prop_t *cont_prop, uuid_t *uuid,
168 daos_event_t *ev);
169
193int
194daos_cont_open(daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh,
195 daos_cont_info_t *info, daos_event_t *ev);
196
212int
214
240int
241daos_cont_destroy(daos_handle_t poh, const char *cont, int force, daos_event_t *ev);
242
272int
274 daos_prop_t *cont_prop, daos_event_t *ev);
275
295int
297 daos_event_t *ev);
314int
316
317
333int
335
352int
354 daos_event_t *ev);
355
376int
378
399int
401 d_string_t name, daos_event_t *ev);
402
421int
422daos_cont_set_owner(daos_handle_t coh, d_string_t user, d_string_t group,
423 daos_event_t *ev);
424
441int
442daos_cont_list_attr(daos_handle_t coh, char *buffer, size_t *size,
443 daos_event_t *ev);
444
463int
464daos_cont_get_attr(daos_handle_t coh, int n, char const *const names[],
465 void *const buffers[], size_t sizes[], daos_event_t *ev);
466
479int
480daos_cont_set_attr(daos_handle_t coh, int n, char const *const names[],
481 void const *const values[], size_t const sizes[],
482 daos_event_t *ev);
483
502int
503daos_cont_del_attr(daos_handle_t coh, int n, char const *const names[],
504 daos_event_t *ev);
505
528int
529daos_cont_alloc_oids(daos_handle_t coh, daos_size_t num_oids, uint64_t *oid,
530 daos_event_t *ev);
531
541int
542daos_cont_aggregate(daos_handle_t coh, daos_epoch_t epoch, daos_event_t *ev);
543
552int
553daos_cont_rollback(daos_handle_t coh, daos_epoch_t epoch, daos_event_t *ev);
554
571int
572daos_cont_subscribe(daos_handle_t coh, daos_epoch_t *epoch, daos_event_t *ev);
573
574#define DAOS_SNAPSHOT_MAX_LEN 128
575
589int
590daos_cont_create_snap(daos_handle_t coh, daos_epoch_t *epoch, char *name,
591 daos_event_t *ev);
592
599
615int
616daos_cont_create_snap_opt(daos_handle_t coh, daos_epoch_t *epoch, char *name,
617 enum daos_snapshot_opts opts, daos_event_t *ev);
618
638int
639daos_cont_list_snap(daos_handle_t coh, int *nr, daos_epoch_t *epochs,
640 char **names, daos_anchor_t *anchor, daos_event_t *ev);
641
655int
657 daos_event_t *ev);
658
663int
664daos_cont_open2(daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh,
665 daos_cont_info_t *info, daos_event_t *ev);
666
671int
672daos_cont_destroy2(daos_handle_t poh, const char *cont, int force, daos_event_t *ev);
673
678int
679daos_cont_create2(daos_handle_t poh, uuid_t *uuid, daos_prop_t *cont_prop, daos_event_t *ev);
680int
681daos_cont_create1(daos_handle_t poh, const uuid_t uuid, daos_prop_t *cont_prop, daos_event_t *ev);
682
683#if defined(__cplusplus)
684}
685
686#define daos_cont_open daos_cont_open_cpp
687static inline int
688daos_cont_open_cpp(daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh,
690{
691 return daos_cont_open2(poh, cont, flags, coh, info, ev);
692}
693
694static inline int
695daos_cont_open_cpp(daos_handle_t poh, const uuid_t cont, unsigned int flags, daos_handle_t *coh,
697{
698 char str[37];
699
700 uuid_unparse(cont, str);
701 return daos_cont_open2(poh, str, flags, coh, info, ev);
702}
703
704#define daos_cont_destroy daos_cont_destroy_cpp
705static inline int
706daos_cont_destroy_cpp(daos_handle_t poh, const char *cont, int force, daos_event_t *ev)
707{
708 return daos_cont_destroy2(poh, cont, force, ev);
709}
710
711static inline int
712daos_cont_destroy_cpp(daos_handle_t poh, const uuid_t cont, int force, daos_event_t *ev)
713{
714 char str[37];
715
716 uuid_unparse(cont, str);
717 return daos_cont_destroy2(poh, str, force, ev);
718}
719
720#define daos_cont_create daos_cont_create_cpp
721static inline int
722daos_cont_create_cpp(daos_handle_t poh, uuid_t *uuid, daos_prop_t *cont_prop, daos_event_t *ev)
723{
724 return daos_cont_create2(poh, uuid, cont_prop, ev);
725}
726
727static inline int
728daos_cont_create_cpp(daos_handle_t poh, const uuid_t uuid, daos_prop_t *cont_prop, daos_event_t *ev)
729{
730 return daos_cont_create1(poh, uuid, cont_prop, ev);
731}
732#else
737#define daos_cont_open(poh, co, ...) \
738 ({ \
739 int _ret; \
740 char _str[37]; \
741 const char *__str = NULL; \
742 if (d_is_string(co)) { \
743 __str = (const char *)(co); \
744 } else if (d_is_uuid(co)) { \
745 uuid_unparse((unsigned char *)(co), _str); \
746 __str = _str; \
747 } \
748 _ret = daos_cont_open2((poh), __str, __VA_ARGS__); \
749 _ret; \
750 })
751
756#define daos_cont_destroy(poh, co, ...) \
757 ({ \
758 int _ret; \
759 char _str[37]; \
760 const char *__str = NULL; \
761 if (d_is_string(co)) { \
762 __str = (const char *)(co); \
763 } else if (d_is_uuid(co)) { \
764 uuid_unparse((unsigned char *)(co), _str); \
765 __str = _str; \
766 } \
767 _ret = daos_cont_destroy2((poh), __str, __VA_ARGS__); \
768 _ret; \
769 })
770
775#define daos_cont_create(poh, co, ...) \
776 ({ \
777 int _ret; \
778 uuid_t *_u; \
779 if (d_is_uuid(co)) { \
780 _u = (uuid_t *)((unsigned char *)(co)); \
781 _ret = daos_cont_create((poh), _u, \
782 __VA_ARGS__); \
783 } else { \
784 _u = (uuid_t *)(co); \
785 _ret = daos_cont_create2((poh), _u, \
786 __VA_ARGS__); \
787 } \
788 _ret; \
789 })
790
791#endif /* __cplusplus */
792#endif /* __DAOS_CONT_H__ */
int daos_cont_create_snap(daos_handle_t coh, daos_epoch_t *epoch, char *name, daos_event_t *ev)
int daos_cont_set_attr(daos_handle_t coh, int n, char const *const names[], void const *const values[], size_t const sizes[], daos_event_t *ev)
int daos_cont_delete_acl(daos_handle_t coh, enum daos_acl_principal_type type, d_string_t name, daos_event_t *ev)
int daos_cont_destroy2(daos_handle_t poh, const char *cont, int force, daos_event_t *ev)
int daos_cont_del_attr(daos_handle_t coh, int n, char const *const names[], daos_event_t *ev)
int daos_cont_create2(daos_handle_t poh, uuid_t *uuid, daos_prop_t *cont_prop, daos_event_t *ev)
int daos_cont_list_attr(daos_handle_t coh, char *buffer, size_t *size, daos_event_t *ev)
int daos_cont_update_acl(daos_handle_t coh, struct daos_acl *acl, daos_event_t *ev)
int daos_cont_local2global(daos_handle_t coh, d_iov_t *glob)
int daos_cont_set_owner(daos_handle_t coh, d_string_t user, d_string_t group, daos_event_t *ev)
int daos_cont_overwrite_acl(daos_handle_t coh, struct daos_acl *acl, daos_event_t *ev)
#define daos_cont_open(poh, co,...)
Definition daos_cont.h:737
int daos_cont_close(daos_handle_t coh, daos_event_t *ev)
int daos_cont_destroy_snap(daos_handle_t coh, daos_epoch_range_t epr, daos_event_t *ev)
int daos_cont_list_snap(daos_handle_t coh, int *nr, daos_epoch_t *epochs, char **names, daos_anchor_t *anchor, daos_event_t *ev)
int daos_cont_create_snap_opt(daos_handle_t coh, daos_epoch_t *epoch, char *name, enum daos_snapshot_opts opts, daos_event_t *ev)
#define daos_cont_destroy(poh, co,...)
Definition daos_cont.h:756
d_rank_list_t * daos_rank_list_parse(const char *str, const char *sep)
int daos_cont_aggregate(daos_handle_t coh, daos_epoch_t epoch, daos_event_t *ev)
int daos_cont_alloc_oids(daos_handle_t coh, daos_size_t num_oids, uint64_t *oid, daos_event_t *ev)
int daos_cont_global2local(daos_handle_t poh, d_iov_t glob, daos_handle_t *coh)
daos_snapshot_opts
Definition daos_cont.h:593
@ DAOS_SNAP_OPT_CR
Definition daos_cont.h:595
@ DAOS_SNAP_OPT_OIT
Definition daos_cont.h:597
int daos_cont_open2(daos_handle_t poh, const char *cont, unsigned int flags, daos_handle_t *coh, daos_cont_info_t *info, daos_event_t *ev)
int daos_cont_create_with_label(daos_handle_t poh, const char *label, daos_prop_t *cont_prop, uuid_t *uuid, daos_event_t *ev)
int daos_cont_get_attr(daos_handle_t coh, int n, char const *const names[], void *const buffers[], size_t sizes[], daos_event_t *ev)
int daos_cont_rollback(daos_handle_t coh, daos_epoch_t epoch, daos_event_t *ev)
int daos_cont_get_acl(daos_handle_t container, daos_prop_t **acl_prop, daos_event_t *ev)
#define daos_cont_create(poh, co,...)
Definition daos_cont.h:775
int daos_cont_status_clear(daos_handle_t coh, daos_event_t *ev)
int daos_cont_set_prop(daos_handle_t coh, daos_prop_t *prop, daos_event_t *ev)
int daos_cont_subscribe(daos_handle_t coh, daos_epoch_t *epoch, daos_event_t *ev)
int daos_cont_query(daos_handle_t container, daos_cont_info_t *info, daos_prop_t *cont_prop, daos_event_t *ev)
daos_acl_principal_type
uint32_t ci_redun_fac
Definition daos_cont.h:49
daos_epoch_t ci_lsnapshot
Definition daos_cont.h:47
uint32_t ci_nsnapshots
Definition daos_cont.h:51