View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.omid.tso;
19  
20  import org.jboss.netty.channel.Channel;
21  
22  interface ReplyProcessor {
23  
24      /**
25       * The each reply to a transactional operation for a client is contained in a batch. The batch must be ordered
26       * before sending the replies in order to not to break snapshot isolation properties.
27       *
28       * @param batchSequence
29       *            a batch sequence number, used to enforce order between replies
30       * @param batch
31       *            a batch containing the transaction operations
32       */
33      void manageResponsesBatch(long batchSequence, Batch batch);
34  
35      /**
36       * Allows to send a commit response back to the client.
37       *
38       * @param startTimestamp
39       *            the start timestamp representing the tx identifier that is going to receive the commit response
40       * @param commitTimestamp
41       *            the commit timestamp
42       * @param channel
43       *            the channel used to send the response back to the client
44       */
45      void sendCommitResponse(long startTimestamp, long commitTimestamp, Channel channel);
46  
47      /**
48       * Allows to send an abort response back to the client.
49       *
50       * @param startTimestamp
51       *            the start timestamp representing the tx identifier that is going to receive the abort response
52       * @param channel
53       *            the channel used to send the response back to the client
54       */
55      void sendAbortResponse(long startTimestamp, Channel channel);
56  
57      /**
58       * Allow to send a timestamp response back to the client.
59       *
60       * @param startTimestamp
61       *            the start timestamp to return that will represent the tx identifier for the created transaction
62       * @param channel
63       *            the channel used to send the response back to the client
64       */
65  
66      void sendTimestampResponse(long startTimestamp, Channel channel);
67  
68  }
69