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  import java.io.Closeable;
23  
24  interface ReplyProcessor extends Closeable {
25  
26      /**
27       * The each reply to a transactional operation for a client is contained in a batch. The batch must be ordered
28       * before sending the replies in order to not to break snapshot isolation properties.
29       *
30       * @param batchSequence
31       *            a batch sequence number, used to enforce order between replies
32       * @param batch
33       *            a batch containing the transaction operations
34       */
35      void manageResponsesBatch(long batchSequence, Batch batch);
36  
37      /**
38       * Allows to send a commit response back to the client.
39       *
40       * @param startTimestamp
41       *            the start timestamp representing the tx identifier that is going to receive the commit response
42       * @param commitTimestamp
43       *            the commit timestamp
44       * @param channel
45       *            the channel used to send the response back to the client
46       */
47      void sendCommitResponse(long startTimestamp, long commitTimestamp, Channel channel, MonitoringContext monCtx);
48  
49      /**
50       * Allows to send an abort response back to the client.
51       *
52       * @param startTimestamp
53       *            the start timestamp representing the tx identifier that is going to receive the abort response
54       * @param channel
55       *            the channel used to send the response back to the client
56       */
57      void sendAbortResponse(long startTimestamp, Channel channel, MonitoringContext monCtx);
58  
59      /**
60       * Allow to send a timestamp response back to the client.
61       *
62       * @param startTimestamp
63       *            the start timestamp to return that will represent the tx identifier for the created transaction
64       * @param channel
65       *            the channel used to send the response back to the client
66       */
67  
68      void sendTimestampResponse(long startTimestamp, Channel channel, MonitoringContext monCtx);
69  
70      /**
71       * Allow to send a fence response back to the client.
72       *
73       * @param tableID
74       *            the table we are creating the fence for
75       * @param fenceTimestamp
76       *            the fence timestamp to return
77       * @param channel
78       *            the channel used to send the response back to the client
79       */
80  
81      void sendFenceResponse(long tableID, long fenceTimestamp, Channel channel, MonitoringContext monCtx);
82  
83  }
84