blob: 9226b42a10206a57610de16e3abe18ea41f3ad01 [file] [log] [blame]
Jens Geyer5a17b132019-05-26 15:53:37 +02001// Licensed to the Apache Software Foundation(ASF) under one
Jens Geyeraa0c8b32019-01-28 23:27:45 +01002// or more contributor license agreements.See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18using System.Threading;
19using System.Threading.Tasks;
20using Thrift.Protocol;
21using Thrift.Transport;
22
23namespace Thrift.Server
24{
25 //TODO: replacement by event?
26
27 /// <summary>
Jens Geyer561bc9a2022-01-26 22:38:04 +010028 /// Interface implemented by server users to handle events from the server
Jens Geyeraa0c8b32019-01-28 23:27:45 +010029 /// </summary>
Jens Geyer561bc9a2022-01-26 22:38:04 +010030 /// <remarks>Replaced by ITServerEventHandler</remarks>
Jens Geyeraa0c8b32019-01-28 23:27:45 +010031 // ReSharper disable once InconsistentNaming
Jens Geyer561bc9a2022-01-26 22:38:04 +010032 #pragma warning disable IDE1006
33 public interface TServerEventHandler : ITServerEventHandler { }
34 #pragma warning restore IDE1006
35
36 /// <summary>
37 /// Interface implemented by server users to handle events from the server
38 /// </summary>
39 public interface ITServerEventHandler
Jens Geyeraa0c8b32019-01-28 23:27:45 +010040 {
41 /// <summary>
42 /// Called before the server begins */
43 /// </summary>
44 Task PreServeAsync(CancellationToken cancellationToken);
45
46 /// <summary>
47 /// Called when a new client has connected and is about to being processing */
48 /// </summary>
49 Task<object> CreateContextAsync(TProtocol input, TProtocol output, CancellationToken cancellationToken);
50
51 /// <summary>
52 /// Called when a client has finished request-handling to delete server context */
53 /// </summary>
54 Task DeleteContextAsync(object serverContext, TProtocol input, TProtocol output,
55 CancellationToken cancellationToken);
56
57 /// <summary>
58 /// Called when a client is about to call the processor */
59 /// </summary>
60 Task ProcessContextAsync(object serverContext, TTransport transport, CancellationToken cancellationToken);
61 }
Jens Geyer5a17b132019-05-26 15:53:37 +020062}