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