1 /* 2 * hunt-amqp: AMQP library for D programming language, based on hunt-net. 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 module hunt.amqp.ProtonDelivery; 12 13 import hunt.proton.amqp.transport.DeliveryState; 14 import hunt.proton.engine.Record; 15 import hunt.Boolean; 16 17 /** 18 * @author <a href="http://tfox.org">Tim Fox</a> 19 */ 20 interface ProtonDelivery { 21 22 /** 23 * Updates the DeliveryState, and optionally settle the delivery as well. 24 * 25 * Has no effect if the delivery was previously locally settled. 26 * 27 * @param state 28 * the delivery state to apply 29 * @param settle 30 * whether to {@link #settle()} the delivery at the same time 31 * @return itself 32 */ 33 ProtonDelivery disposition(DeliveryState state, bool settle); 34 35 /** 36 * Gets the current local state for the delivery. 37 * 38 * @return the delivery state 39 */ 40 DeliveryState getLocalState(); 41 42 /** 43 * Gets the current remote state for the delivery. 44 * 45 * @return the remote delivery state 46 */ 47 DeliveryState getRemoteState(); 48 49 /** 50 * Settles the delivery locally. 51 * 52 * @return the delivery 53 */ 54 ProtonDelivery settle(); 55 56 /** 57 * Gets whether the delivery was locally settled yet. 58 * 59 * @return whether the delivery is locally settled 60 */ 61 bool isSettled(); 62 63 /** 64 * Gets whether the delivery was settled by the remote peer yet. 65 * 66 * @return whether the delivery is remotely settled 67 */ 68 bool remotelySettled(); 69 70 /** 71 * Retrieves the attachments record, upon which application items can be set/retrieved. 72 * 73 * @return the attachments 74 */ 75 Record attachments(); 76 77 /** 78 * Gets the delivery tag for this delivery 79 * 80 * @return the tag 81 */ 82 byte[] getTag(); 83 84 /** 85 * Gets the message format for the current delivery. 86 * 87 * @return the message format 88 */ 89 int getMessageFormat(); 90 }