1 /*=========================================================================== 2 * 3 * PUBLIC DOMAIN NOTICE 4 * National Center for Biotechnology Information 5 * 6 * This software/database is a "United States Government Work" under the 7 * terms of the United States Copyright Act. It was written as part of 8 * the author's official duties as a United States Government employee and 9 * thus cannot be copyrighted. This software/database is freely available 10 * to the public for use. The National Library of Medicine and the U.S. 11 * Government have not placed any restriction on its use or reproduction. 12 * 13 * Although all reasonable efforts have been taken to ensure the accuracy 14 * and reliability of the software and data, the NLM and the U.S. 15 * Government do not and cannot warrant the performance or results that 16 * may be obtained by using this software or data. The NLM and the U.S. 17 * Government disclaim all warranties, express or implied, including 18 * warranties of performance, merchantability or fitness for any particular 19 * purpose. 20 * 21 * Please cite the author in any work or product based on this material. 22 * 23 * =========================================================================== 24 * 25 */ 26 27 #ifndef _h_sra_sort_ 28 #define _h_sra_sort_ 29 30 #ifndef _h_sra_sort_defs_ 31 #include "sort-defs.h" 32 #endif 33 34 #ifndef _h_kfs_defs_ 35 #include <kfs/defs.h> 36 #endif 37 38 #ifndef _h_kdb_column_ 39 #include <kdb/column.h> 40 #endif 41 42 43 #define NEW_TYPES 1 44 45 /*-------------------------------------------------------------------------- 46 * forwards 47 */ 48 struct DbPair; 49 struct TablePair; 50 51 52 /*-------------------------------------------------------------------------- 53 * Selection 54 * input selection criteria 55 */ 56 typedef struct Selection Selection; 57 struct Selection 58 { 59 int dummy; 60 }; 61 62 /*-------------------------------------------------------------------------- 63 * Tool 64 * parameter block generated by KMain 65 */ 66 typedef struct Tool Tool; 67 struct Tool 68 { 69 /* input selection */ 70 const Selection *sel; 71 72 /* directory for temporary files */ 73 const char *tmpdir; 74 75 /* directory for mmap page files */ 76 const char *mmapdir; 77 78 /* source object path */ 79 const char *src_path; 80 81 /* destination object path */ 82 const char *dst_path; 83 84 /* buffer size for id map files */ 85 size_t map_file_bsize; 86 size_t map_file_random_bsize; 87 88 /* the number of ids to gather at a time */ 89 size_t max_ref_idx_ids; 90 size_t max_large_idx_ids; 91 size_t max_poslen_ids; 92 size_t max_idx_ids; 93 size_t min_idx_ids; 94 95 /* the number of missing SEQUENCE ids to gather at a time */ 96 size_t max_missing_ids; 97 98 /* pid of tool */ 99 int pid; 100 101 /* db create mode */ 102 struct 103 { 104 KCreateMode cmode; 105 } db; 106 107 /* tbl create mode */ 108 struct 109 { 110 KCreateMode cmode; 111 } tbl; 112 113 /* column blob checksum mode */ 114 struct 115 { 116 size_t pgsize; 117 KCreateMode cmode; 118 KChecksum checksum; 119 } col; 120 121 /* ignore failure on multiple sorts */ 122 bool ignore; 123 124 /* force overwrite */ 125 bool force; 126 127 /* write new=>old mappings 128 not normally needed */ 129 bool write_new_to_old; 130 131 /* whether to apply a sort on old-id 132 before writing old=>new mapping or 133 to let pagefile handle it */ 134 bool sort_before_old2new; 135 136 /* normally remove idx files right away 137 but if they are being debugged... */ 138 bool unlink_idx_files; 139 140 /* perform consistency check on index */ 141 bool idx_consistency_check; 142 }; 143 144 145 /*-------------------------------------------------------------------------- 146 * TypeParams 147 * object type params 148 */ 149 typedef struct TypeParams TypeParams; 150 struct TypeParams 151 { 152 char src_type [ 256 ]; 153 char dst_type [ 256 ]; 154 char view_type [ 256 ]; 155 }; 156 157 158 /*-------------------------------------------------------------------------- 159 * sra-sort functions 160 */ 161 162 /* run 163 * called from KMain 164 * determines the type of object being copied/sorted 165 * opens input object 166 * dispatches to the appropriate handler 167 */ 168 void run ( const ctx_t *ctx ); 169 170 171 #endif 172