Skip to content

Commit bb380a2

Browse files
authored
New interface changes (#493)
1 parent 658cce9 commit bb380a2

13 files changed

Lines changed: 9 additions & 205 deletions

source/connection/flow/i_flow_factory.hpp

Lines changed: 0 additions & 10 deletions
This file was deleted.

source/connection/flow/i_new_flow.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ struct FlowContext {
2323
// path
2424
class INewFlow : public virtual Identifiable {
2525
public:
26-
// Callback that should be triggered when packet arrives to endpoint
27-
virtual void on_packet(const Packet& packet) = 0;
28-
2926
virtual void send(std::vector<Packet> packets) = 0;
3027

3128
virtual const FlowContext& get_context() = 0;

source/connection/i_new_connection.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ struct ConnectionContext {
1717
// Logical path in network. Corresponds to application layer in TCP\IP stack
1818
class INewConnection : public virtual Identifiable {
1919
public:
20-
virtual void add_data_to_send(Data data) = 0;
20+
virtual void send_data(Data data, OnDeliveryCallback callback) = 0;
2121

2222
// Confirm data_size bytes delivery for data with given id
23-
virtual void confirm(DataId id, SizeByte data_size) = 0;
23+
virtual const ConnectionContext& get_context() const = 0;
2424
};
2525

2626
} // namespace sim

source/connection/mplb/i_new_mplb.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ struct MPLBContext {
2020
// Owns multiple flows; balances the load between them
2121
class INewMPLB {
2222
public:
23-
// Callback that is triggered when ack is received by sender of a given flow
24-
virtual void on_ack(std::shared_ptr<const INewFlow> flow, const Packet& ack,
25-
std::vector<PacketNum> confinfed_packet_nums) = 0;
23+
// Forward data to transport layer
24+
// Returns error given data might not be sent (e.g. its size greater than
25+
// quota)
26+
virtual utils::StrExpected<void> send_data(Data data,
27+
OnDeliveryCallback callback) = 0;
2628

27-
// Forward data to transport layer as much as possible
28-
// Returns size of transfered data
29-
virtual SizeByte send_data(Data data) = 0;
29+
virtual const MPLBContext& get_context() const = 0;
3030
};
3131

3232
} // namespace sim

source/packet.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct Packet {
2828
Id dest_id;
2929
SizeByte size;
3030
IFlow* flow;
31+
OnDeliveryCallback callback = []() {};
3132
TimeNs generated_time; // Note: ACK's generated time is the data packet
3233
// generated time
3334
TimeNs sent_time; // Note: ACK's sent time is the data packet sent time

test/_mocks/flow_factory_mock.cpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/_mocks/flow_factory_mock.hpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/_mocks/new_conn_mock.cpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

test/_mocks/new_conn_mock.hpp

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/_mocks/new_flow_mock.cpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)