1 /*
2  * hunt-proton: AMQP Protocol library for D programming language.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 module hunt.proton.engine.impl.TransportDelivery;
13 
14 import hunt.proton.amqp.UnsignedInteger;
15 import hunt.proton.engine.impl.DeliveryImpl;
16 import hunt.proton.engine.impl.TransportLink;
17 
18 class TransportDelivery
19 {
20     private UnsignedInteger _deliveryId;
21     private DeliveryImpl _delivery;
22     private TransportLink _transportLink;
23     private int _sessionSize = 1;
24 
25     this(UnsignedInteger currentDeliveryId, DeliveryImpl delivery, TransportLink transportLink)
26     {
27         _deliveryId = currentDeliveryId;
28         _delivery = delivery;
29         _transportLink = transportLink;
30     }
31 
32     public UnsignedInteger getDeliveryId()
33     {
34         return _deliveryId;
35     }
36 
37     public TransportLink getTransportLink()
38     {
39         return _transportLink;
40     }
41 
42     void incrementSessionSize()
43     {
44         _sessionSize++;
45     }
46 
47     int getSessionSize()
48     {
49         return _sessionSize;
50     }
51 
52     void settled()
53     {
54         _transportLink.settled(this);
55         _delivery.updateWork();
56     }
57 }