OpenMPI  0.1.1
base.h
1 /*
2  * Copyright (c) 2010 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * $COPYRIGHT$
6  *
7  * Additional copyrights may follow
8  *
9  * $HEADER$
10  */
11 #ifndef ORTE_SSTORE_BASE_H
12 #define ORTE_SSTORE_BASE_H
13 
14 #include "orte_config.h"
15 
16 #if !ORTE_DISABLE_FULL_SUPPORT
17 #include "orte/mca/rml/rml.h"
18 #endif
19 
20 #include "orte/mca/sstore/sstore.h"
21 
22 /*
23  * Global functions for MCA overall SStore
24  */
25 
26 BEGIN_C_DECLS
27 
28 /**
29  * Initialize the SSTORE MCA framework
30  *
31  * @retval ORTE_SUCCESS Upon success
32  * @retval ORTE_ERROR Upon failures
33  *
34  * This function is invoked during orte_init();
35  */
36 ORTE_DECLSPEC int orte_sstore_base_open(void);
37 
38 #if !ORTE_DISABLE_FULL_SUPPORT
39  /**
40  * Select an available component.
41  *
42  * @retval ORTE_SUCCESS Upon Success
43  * @retval ORTE_NOT_FOUND If no component can be selected
44  * @retval ORTE_ERROR Upon other failure
45  *
46  */
47  ORTE_DECLSPEC int orte_sstore_base_select(void);
48 
49  /**
50  * Finalize the SSTORE MCA framework
51  *
52  * @retval ORTE_SUCCESS Upon success
53  * @retval ORTE_ERROR Upon failures
54  *
55  * This function is invoked during orte_finalize();
56  */
57  ORTE_DECLSPEC int orte_sstore_base_close(void);
58 
59  /**
60  * Object stuff
61  */
62  void orte_sstore_base_local_snapshot_info_construct(orte_sstore_base_local_snapshot_info_t *snapshot);
63  void orte_sstore_base_local_snapshot_info_destruct( orte_sstore_base_local_snapshot_info_t *snapshot);
64 
65  void orte_sstore_base_global_snapshot_info_construct(orte_sstore_base_global_snapshot_info_t *snapshot);
66  void orte_sstore_base_global_snapshot_info_destruct( orte_sstore_base_global_snapshot_info_t *snapshot);
67 
68  /**
69  * Globals
70  */
71  ORTE_DECLSPEC extern int orte_sstore_base_output;
72  ORTE_DECLSPEC extern opal_list_t orte_sstore_base_components_available;
73  ORTE_DECLSPEC extern orte_sstore_base_component_t orte_sstore_base_selected_component;
74  ORTE_DECLSPEC extern orte_sstore_base_module_t orte_sstore;
75 
76  /*
77  * Context of this module
78  */
79 #define ORTE_SSTORE_UNASSIGN_TYPE 0
80 #define ORTE_SSTORE_GLOBAL_TYPE 1
81 #define ORTE_SSTORE_LOCAL_TYPE 2
82 #define ORTE_SSTORE_TOOL_TYPE 4
83 #define ORTE_SSTORE_APP_TYPE 8
84  ORTE_DECLSPEC extern int orte_sstore_context;
85 
86  /**
87  * Snapshot metadata
88  */
89 #define SSTORE_METADATA_LOCAL_CRS_COMP_STR CRS_METADATA_COMP
90 #define SSTORE_METADATA_LOCAL_PID_STR CRS_METADATA_PID
91 #define SSTORE_METADATA_LOCAL_CONTEXT_STR CRS_METADATA_CONTEXT
92 #define SSTORE_METADATA_LOCAL_MKDIR_STR CRS_METADATA_MKDIR
93 #define SSTORE_METADATA_LOCAL_TOUCH_STR CRS_METADATA_TOUCH
94 
95 #define SSTORE_METADATA_LOCAL_COMPRESS_COMP_STR ("# OPAL Compress Component: ")
96 #define SSTORE_METADATA_LOCAL_COMPRESS_POSTFIX_STR ("# OPAL Compress Postfix: ")
97 
98 #define SSTORE_METADATA_LOCAL_SNAP_REF_FMT_STR ("# Local Snapshot Format Reference: ")
99 #define SSTORE_METADATA_GLOBAL_SNAP_SEQ_STR ("# Seq: ")
100 #define SSTORE_METADATA_GLOBAL_AMCA_PARAM_STR ("# AMCA: ")
101 
102 #define SSTORE_METADATA_INTERNAL_DONE_SEQ_STR ("# Finished Seq: ")
103 #define SSTORE_METADATA_INTERNAL_TIME_STR ("# Timestamp: ")
104 #define SSTORE_METADATA_INTERNAL_PROCESS_STR ("# Process: ")
105 
106 #define SSTORE_METADATA_INTERNAL_MIG_SEQ_STR ("# Migrate Seq: ")
107 #define SSTORE_METADATA_INTERNAL_DONE_MIG_SEQ_STR ("# Finished Migrate Seq: ")
108 
109 
110  /**
111  * Some utility functions
112  */
113  ORTE_DECLSPEC extern bool orte_sstore_base_is_checkpoint_available;
114  ORTE_DECLSPEC extern char * orte_sstore_base_local_metadata_filename;
115  ORTE_DECLSPEC extern char * orte_sstore_base_global_metadata_filename;
116  ORTE_DECLSPEC extern char * orte_sstore_base_local_snapshot_fmt;
117  ORTE_DECLSPEC extern char * orte_sstore_base_global_snapshot_dir;
118  ORTE_DECLSPEC extern char * orte_sstore_base_global_snapshot_ref;
119  ORTE_DECLSPEC extern char * orte_sstore_base_prelaunch_location;
120 
121  ORTE_DECLSPEC int orte_sstore_base_get_global_snapshot_ref(char **name_str, pid_t pid);
122 
123  ORTE_DECLSPEC int orte_sstore_base_convert_key_to_string(orte_sstore_base_key_t key, char **key_str);
124  ORTE_DECLSPEC int orte_sstore_base_convert_string_to_key(char *key_str, orte_sstore_base_key_t *key);
125 
126  ORTE_DECLSPEC int orte_sstore_base_metadata_read_next_seq_num(FILE *file);
127  ORTE_DECLSPEC int orte_sstore_base_metadata_read_next_token(FILE *file, char **token, char **value);
128  ORTE_DECLSPEC int orte_sstore_base_metadata_seek_to_seq_num(FILE *file, int seq_num);
129 
130  ORTE_DECLSPEC int orte_sstore_base_extract_global_metadata(orte_sstore_base_global_snapshot_info_t *global_snapshot);
131  ORTE_DECLSPEC int orte_sstore_base_get_all_snapshots(opal_list_t *all_snapshots, char *basedir);
132  ORTE_DECLSPEC int orte_sstore_base_find_largest_seq_num(orte_sstore_base_global_snapshot_info_t *global_snapshot, int *seq_num);
133  ORTE_DECLSPEC int orte_sstore_base_find_all_seq_nums(orte_sstore_base_global_snapshot_info_t *global_snapshot, int *num_seq, char ***seq_list);
134 
135 /*
136  * Common Tool functionality for interfacing with orte-restart/checkpoint
137  */
138 ORTE_DECLSPEC int orte_sstore_base_tool_request_restart_handle(orte_sstore_base_handle_t *handle,
139  char *basedir, char *ref, int seq,
141 ORTE_DECLSPEC int orte_sstore_base_tool_get_attr(orte_sstore_base_handle_t handle, orte_sstore_base_key_t key, char **value);
142 
143 #endif /* ORTE_DISABLE_FULL_SUPPORT */
144 
145 END_C_DECLS
146 
147 #endif /* ORTE_SSTORE_BASE_H */
Structure for SSTORE modules.
Definition: sstore.h:359
Distributed Stable Storage (SStore) Interface.
Structure for SSTORE components.
Definition: sstore.h:340
Runtime Messaging Layer (RML) Communication Interface.
BEGIN_C_DECLS typedef uint32_t orte_sstore_base_key_t
Keys accepted as metadata.
Definition: sstore.h:36
Local and Global snapshot information structure Primarily used by orte-restart as an abstract way to ...
Definition: sstore.h:110
Definition: opal_list.h:147