1 #ifndef PUBSEQ_GATEWAY_TYPES__HPP
2 #define PUBSEQ_GATEWAY_TYPES__HPP
3 
4 /*  $Id: pubseq_gateway_types.hpp 629837 2021-04-22 12:47:49Z ivanov $
5  * ===========================================================================
6  *
7  *                            PUBLIC DOMAIN NOTICE
8  *               National Center for Biotechnology Information
9  *
10  *  This software/database is a "United States Government Work" under the
11  *  terms of the United States Copyright Act.  It was written as part of
12  *  the author's official duties as a United States Government employee and
13  *  thus cannot be copyrighted.  This software/database is freely available
14  *  to the public for use. The National Library of Medicine and the U.S.
15  *  Government have not placed any restriction on its use or reproduction.
16  *
17  *  Although all reasonable efforts have been taken to ensure the accuracy
18  *  and reliability of the software and data, the NLM and the U.S.
19  *  Government do not and cannot warrant the performance or results that
20  *  may be obtained by using this software or data. The NLM and the U.S.
21  *  Government disclaim all warranties, express or implied, including
22  *  warranties of performance, merchantability or fitness for any particular
23  *  purpose.
24  *
25  *  Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Sergey Satskiy
30  *
31  * File Description:
32  *
33  */
34 
35 // Processor priority
36 // The higher the value the higher the priority is
37 typedef int     TProcessorPriority;
38 const int       kUnknownPriority = -1;
39 
40 
41 // Error codes for the PSG protocol messages
42 enum EPSGS_PubseqGatewayErrorCode {
43     ePSGS_UnknownSatellite = 300,
44     ePSGS_BadURL,
45     ePSGS_NoUsefulCassandra,
46     ePSGS_MissingParameter,
47     ePSGS_MalformedParameter,
48     ePSGS_UnknownResolvedSatellite,
49     ePSGS_NoBioseqInfo,
50     ePSGS_BioseqInfoError,
51     ePSGS_BadID2Info,
52     ePSGS_UnpackingError,
53     ePSGS_UnknownError,
54     ePSGS_BlobPropsNotFound,
55     ePSGS_UnresolvedSeqId,
56     ePSGS_InsufficientArguments,
57     ePSGS_InvalidId2Info,
58     ePSGS_SplitHistoryNotFound,
59     ePSGS_BioseqInfoNotFoundForGi,       // whole bioseq_info record not found
60     ePSGS_BioseqInfoGiNotFoundForGi,     // gi is not found in in the seq_ids field
61                                          // in the bioseq_info record
62     ePSGS_BioseqInfoMultipleRecords,
63     ePSGS_ServerLogicError,
64     ePSGS_BioseqInfoAccessionAdjustmentError,
65     ePSGS_NoProcessor,
66     ePSGS_ShuttingDown,
67     ePSGS_Unauthorised,
68 
69     ePSGS_TestIOError,          // Exceptions when handling certain requests
70     ePSGS_StatisticsError,      //
71     ePSGS_AckAlertError,        //
72     ePSGS_GetAlertsError,       //
73     ePSGS_ShutdownError,        //
74     ePSGS_StatusError,          //
75     ePSGS_InfoError,            //
76     ePSGS_ConfigError,          //
77     ePSGS_HealthError,          //
78 
79     ePSGS_TooManyRequests,
80     ePSGS_RequestCancelled
81 };
82 
83 
84 enum EPSGS_ResolutionResult {
85     ePSGS_Si2csiCache,
86     ePSGS_Si2csiDB,
87     ePSGS_BioseqCache,
88     ePSGS_BioseqDB,
89     ePSGS_NotResolved,
90     ePSGS_PostponedForDB
91 };
92 
93 
94 enum EPSGS_SeqIdParsingResult {
95     ePSGS_ParsedOK,
96     ePSGS_ParseFailed
97 };
98 
99 
100 enum EPSGS_DbFetchType {
101     ePSGS_BlobBySeqIdFetch,
102     ePSGS_BlobBySatSatKeyFetch,
103     ePSGS_AnnotationFetch,
104     ePSGS_TSEChunkFetch,
105     ePSGS_BioseqInfoFetch,
106     ePSGS_Si2csiFetch,
107     ePSGS_SplitHistoryFetch,
108     ePSGS_PublicCommentFetch,
109     ePSGS_UnknownFetch
110 };
111 
112 
113 enum EPSGS_CacheLookupResult {
114     ePSGS_CacheHit,
115     ePSGS_CacheNotHit,
116     ePSGS_CacheFailure          // LMDB may throw an exception
117 };
118 
119 
120 enum EPSGS_AccessionAdjustmentResult {
121     ePSGS_NotRequired,
122     ePSGS_AdjustedWithGi,
123     ePSGS_AdjustedWithAny,
124     ePSGS_SeqIdsEmpty,
125     ePSGS_LogicError
126 };
127 
128 
129 enum EPSGS_ReplyMimeType {
130     ePSGS_JsonMime,
131     ePSGS_BinaryMime,
132     ePSGS_PlainTextMime,
133     ePSGS_ImageMime,
134     ePSGS_PSGMime,
135 
136     ePSGS_NotSet
137 };
138 
139 
140 enum EPSGS_BlobSkipReason {
141     ePSGS_BlobExcluded,
142     ePSGS_BlobInProgress,
143     ePSGS_BlobSent
144 };
145 
146 
147 // At startup time the server does the following:
148 // - opens a database connection
149 // - reads mapping from the root keyspace
150 // - creates a cache for si2csi, bioseqinfo and blobprop
151 // If there is an error on any of these stages the server tries to recover
152 // periodically
153 enum EPSGS_StartupDataState {
154     ePSGS_NoCassConnection,
155     ePSGS_NoValidCassMapping,
156     ePSGS_NoCassCache,
157     ePSGS_StartupDataOK
158 };
159 
160 #endif
161 
162