OnixS C++ CME iLink 3 Binary Order Entry Handler  1.9.0
API Documentation
SessionStorage.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*
4 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
5 *
6 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
7 * and international copyright treaties.
8 *
9 * Access to and use of the software is governed by the terms of the applicable OnixS Software
10 * Services Agreement (the Agreement) and Customer end user license agreements granting
11 * a non-assignable, non-transferable and non-exclusive license to use the software
12 * for it's own data processing purposes under the terms defined in the Agreement.
13 *
14 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
15 * of this source code or associated reference material to any other location for further reproduction
16 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
17 *
18 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
19 * the terms of the Agreement is a violation of copyright law.
20 */
21 
22 #include <OnixS/CME/iLink3/ABI.h>
27 
28 #include <string>
29 #include <vector>
30 
31 namespace OnixS {
32 namespace CME {
33 namespace iLink3 {
34 
35 using namespace OnixS::CME::iLink3::Messaging;
36 
37 /// Session Storage Type.
39 {
40  enum Enum
41  {
42  /// Undefined Session Storage.
43  Undefined = 0,
44 
45  /// File-based Session Storage.
47 
48  /// Asynchronous File-Based Session Storage.
50 
51  /// Memory-based Session Storage.
53 
54  /// Pluggable Session Storage
55  Pluggable
56  };
57 
58  ONIXS_ILINK3_EXPORTED static Enum parse(const std::string &);
59 
60  /// \return the session storage type as a string.
61  ONIXS_ILINK3_EXPORTED static const char * toString(SessionStorageType::Enum);
62 };
63 
64 /// Session's storage.
66 {
67 public:
68 
69  /// Destructor.
70  virtual ~SessionStorage() ONIXS_ILINK3_DEFAULT;
71 
72  /// \return Storage Id.
73  virtual const std::string & id() const = 0;
74 
75  /// \return Universally Unique Identifier (UUID).
76  virtual UInt64 uuid() const = 0;
77 
78  /// Sets Universally Unique Identifier (UUID).
79  virtual void uuid(UInt64 value) = 0;
80 
81  /**
82  * \return The UUID from the previously Established session.
83  *
84  * - This can be the CME assigned default UUID=0 for messages published by CME before first Negotiation of customer at the beginning of the week.
85  * - This can be the last UUID as used by the customer from the previously Established session.
86  */
87  virtual UInt64 previousUuid() const = 0;
88 
89  /// Sets the UUID from the previously Established session.
90  virtual void previousUuid(UInt64 value) = 0;
91 
92  /// \return the expected sequence number of the next inbound message.
93  virtual SeqNumber inSeqNum() const = 0;
94 
95  /// Sets the expected sequence number of the next inbound message.
96  virtual void inSeqNum(SeqNumber msgSeqNum) = 0;
97 
98  /**
99  * \return the sequence number of the last business message published by CME with the PreviousUUID.
100  *
101  * If no business message was published, the value is zero.
102  */
103  virtual SeqNumber previousSeqNum() const = 0;
104 
105  /// Sets the sequence number of the last business message published by CME with the PreviousUUID.
106  virtual void previousSeqNum(SeqNumber msgSeqNum) = 0;
107 
108  /// \return the sequence number of the next outgoing message.
109  virtual SeqNumber outSeqNum() const = 0;
110 
111  /// Sets the sequence number of the next outgoing message.
112  virtual void outSeqNum(SeqNumber msgSeqNum) = 0;
113 
114  /// \return `true` if the logical session that used this storage was terminated and the storage can be cleaned up, otherwise - `false`.
115  virtual bool terminated() const = 0;
116 
117  /// Sets the Session Termination status.
118  virtual void terminated(bool terminated) = 0;
119 
120  /// \return `true` if the session is negotiated (the Negotiation Response message has been received in reply to the Negotiation message),
121  /// otherwise - `false`.
122  virtual bool negotiated() const = 0;
123 
124  /// Sets the "negotiated" status.
125  ///
126  /// The session is negotiated when the Negotiation Response message has been received in reply to the Negotiation message.
127  virtual void negotiated(bool negotiated) = 0;
128 
129  /// \return the session creation time.
130  virtual Timestamp sessionCreationTime() const = 0;
131 
132  /// Sets the session creation time.
133  virtual void sessionCreationTime(Timestamp) = 0;
134 
135  /// Clears the storage.
136  virtual void clear() = 0;
137 
138  /// Closes the storage.
139  virtual void close(bool terminate = false, bool doBackup = false) = 0;
140 
141  /// Pointer to the SBE Message.
143  {
144  RawMessagePointer(const char *buffer = ONIXS_ILINK3_NULLPTR, size_t length = 0)
145  : buffer_(buffer)
146  , length_(length)
147  {}
148 
149  /// \note the buffer is NOT owned by the RawMessagePointer.
150  const char *buffer_;
151 
152  size_t length_;
153  };
154 
155  /// Logs the given inbound message.
156  virtual void storeInboundMessage(const RawMessagePointer & rawMsg, SeqNumber msgSeqNum, bool isOriginal, Timestamp messageReceivingUtcTimestamp = Timestamp()) = 0;
157 
158  /// Logs the given outgoing message.
159  virtual void storeOutboundMessage(const RawMessagePointer & rawMsg, SeqNumber msgSeqNum, bool isOriginal = true, bool warmUp = false, Timestamp messageSendingUtcTimestamp = Timestamp()) = 0;
160 
161  /// Flushes all internal buffers.
162  virtual void flush() = 0;
163 };
164 
165 }
166 }
167 }
Messaging::UInt32 SeqNumber
Definition: Messaging.h:58
Definition: Defines.h:40
RawMessagePointer(const char *buffer=ONIXS_ILINK3_NULLPTR, size_t length=0)
#define ONIXS_ILINK3_EXPORTED
Definition: Compiler.h:162
UInt64 UInt64
uInt64.
Definition: Fields.h:276
Asynchronous File-Based Session Storage.
The time point without the time-zone information.
Definition: Time.h:453