UnacknowledgedMessageMap.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.server.ack;
22 
23 import java.util.Collection;
24 import java.util.List;
25 import java.util.Set;
26 import java.util.Map;
27 
28 import org.apache.qpid.AMQException;
29 import org.apache.qpid.server.txn.TransactionalContext;
30 import org.apache.qpid.server.queue.QueueEntry;
31 import org.apache.qpid.server.store.StoreContext;
32 
33 public interface UnacknowledgedMessageMap
34 {
35     public interface Visitor
36     {
37         /**
38          @param deliveryTag
39          *@param message the message being iterated over @return true to stop iteration, false to continue
40          @throws AMQException
41          */
42         boolean callback(final long deliveryTag, QueueEntry messagethrows AMQException;
43 
44         void visitComplete();
45     }
46 
47     void visit(Visitor visitorthrows AMQException;
48 
49     void add(long deliveryTag, QueueEntry message);
50 
51     void collect(long deliveryTag, boolean multiple, Map<Long, QueueEntry> msgs);
52 
53     boolean contains(long deliveryTagthrows AMQException;
54 
55     void remove(Map<Long,QueueEntry> msgs);
56 
57     QueueEntry remove(long deliveryTag);
58 
59     public void drainTo(long deliveryTag, StoreContext storeContextthrows AMQException;
60     
61     Collection<QueueEntry> cancelAllMessages();
62 
63     void acknowledgeMessage(long deliveryTag, boolean multiple, TransactionalContext txnContextthrows AMQException;
64 
65     int size();
66 
67     void clear();
68 
69     QueueEntry get(long deliveryTag);
70 
71     /**
72      * Get the set of delivery tags that are outstanding.
73      *
74      @return a set of delivery tags
75      */
76     Set<Long> getDeliveryTags();
77 
78     public long getUnacknowledgeBytes();
79 }
80