OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.9
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  /// Destructor.
70 
71  /// \return Storage Id.
72  virtual const std::string & id() const = 0;
73 
74  /// \return Universally Unique Identifier (UUID).
75  virtual UInt64 uuid() const = 0;
76 
77  /// Sets Universally Unique Identifier (UUID).
78  virtual void uuid(UInt64 value) = 0;
79 
80  /**
81  * \return The UUID from the previously established session.
82  *
83  * - This can be the CME assigned default UUID=0 for messages published by CME before the first Negotiation of the customer at the beginning of the week.
84  * - This can be the last UUID used by the customer from the previously established session.
85  */
86  virtual UInt64 previousUuid() const = 0;
87 
88  /// Sets the UUID from the previously Established session.
89  virtual void previousUuid(UInt64 value) = 0;
90 
91  /// \return the expected sequence number of the next inbound message.
92  virtual SeqNumber inSeqNum() const = 0;
93 
94  /// Sets the expected sequence number of the next inbound message.
95  virtual void inSeqNum(SeqNumber msgSeqNum) = 0;
96 
97  /**
98  * \return the sequence number of the last business message published by CME with the PreviousUUID.
99  *
100  * If no business message was published, the value is zero.
101  */
102  virtual SeqNumber previousSeqNum() const = 0;
103 
104  /// Sets the sequence number of the last business message published by CME with the PreviousUUID.
105  virtual void previousSeqNum(SeqNumber msgSeqNum) = 0;
106 
107  /// \return the sequence number of the next outgoing message.
108  virtual SeqNumber outSeqNum() const = 0;
109 
110  /// Sets the sequence number of the next outgoing message.
111  virtual void outSeqNum(SeqNumber msgSeqNum) = 0;
112 
113  /// \return `true` if the session is negotiated (the Negotiation Response message has been received in reply to the Negotiation message);
114  /// otherwise - `false`.
115  virtual bool negotiated() const = 0;
116 
117  /// Sets the "negotiated" status.
118  ///
119  /// The session is negotiated when the Negotiation Response message has been received in reply to the Negotiation message.
120  virtual void negotiated(bool negotiated) = 0;
121 
122  /// \return the session creation time.
123  virtual Timestamp sessionCreationTime() const = 0;
124 
125  /// Sets the session creation time.
126  virtual void sessionCreationTime(Timestamp) = 0;
127 
128  /// Closes the storage.
129  virtual void close(bool doBackup = false) = 0;
130 
131  /// Logs the given inbound message.
132  virtual void storeInboundMessage(const NetworkMessage& message, SeqNumber msgSeqNum, Timestamp messageReceivingUtcTimestamp = Timestamp()) = 0;
133 
134  /// Logs the given outgoing message.
135  virtual void storeOutboundMessage(const NetworkMessage& message, SeqNumber msgSeqNum, Timestamp messageSendingUtcTimestamp = Timestamp()) = 0;
136 
137  /// Flushes all internal buffers.
138  virtual void flush() = 0;
139 
140  /// Warmup the storage.
141  virtual void warmup(size_t messageSize, Timestamp ts = Timestamp()) = 0;
142 };
143 
144 }
145 }
146 }
Messaging::UInt32 SeqNumber
Definition: Messaging.h:60
Definition: Defines.h:40
#define ONIXS_ILINK3_DEFAULT
Definition: Compiler.h:202
#define ONIXS_ILINK3_EXPORTED
Definition: Compiler.h:175
UInt64 UInt64
uInt64.
Definition: Fields.h:308
Asynchronous File-Based Session Storage.
The time point without the time-zone information.
Definition: Time.h:467