21 #ifndef KINETIC_CPP_CLIENT_NONBLOCKING_PACKET_H_
22 #define KINETIC_CPP_CLIENT_NONBLOCKING_PACKET_H_
26 #include "kinetic/common.h"
28 #include "kinetic_client.pb.h"
29 #include "nonblocking_string.h"
33 using std::shared_ptr;
34 using std::unique_ptr;
37 using com::seagate::kinetic::client::proto::Message;
51 virtual NonblockingStringStatus Write() = 0;
57 const shared_ptr<const string> value);
59 NonblockingStringStatus Write();
62 bool TransitionFromMagic();
63 void TransitionFromMessageLength();
64 void TransitionFromValueLength();
65 void TransitionFromMessage();
66 void TransitionFromValue();
67 shared_ptr<SocketWrapperInterface> socket_wrapper_;
68 unique_ptr<const Message> message_;
69 const shared_ptr<const string> value_;
72 std::string serialized_message_;
78 NonblockingPacketReader(shared_ptr<SocketWrapperInterface> socket_wrapper, Message* response, unique_ptr<const string>& value);
80 NonblockingStringStatus Read();
83 bool TransitionFromMagic();
84 void TransitionFromMessageLength();
85 void TransitionFromValueLength();
86 void TransitionFromMessage();
87 bool TransitionFromValue();
88 shared_ptr<SocketWrapperInterface> socket_wrapper_;
89 Message*
const response_;
91 unique_ptr<const string>& value_;
92 unique_ptr<const string> magic_;
93 unique_ptr<const string> message_length_;
94 unique_ptr<const string> value_length_;
95 unique_ptr<const string> message_;
103 virtual unique_ptr<NonblockingPacketWriterInterface> CreateWriter(shared_ptr<SocketWrapperInterface> socket_wrapper,
104 unique_ptr<const Message> message,
const shared_ptr<const string> value) = 0;
109 unique_ptr<NonblockingPacketWriterInterface> CreateWriter(shared_ptr<SocketWrapperInterface> socket_wrapper,
110 unique_ptr<const Message> message,
const shared_ptr<const string> value);
115 #endif // KINETIC_CPP_CLIENT_NONBLOCKING_PACKET_H_