Jens Geyer | 5a17b13 | 2019-05-26 15:53:37 +0200 | [diff] [blame] | 1 | // Licensed to the Apache Software Foundation(ASF) under one |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 2 | // 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 | |
| 18 | using System.Threading; |
| 19 | using System.Threading.Tasks; |
| 20 | using Thrift.Protocol; |
| 21 | using Thrift.Transport; |
| 22 | |
| 23 | namespace Thrift.Server |
| 24 | { |
| 25 | //TODO: replacement by event? |
| 26 | |
| 27 | /// <summary> |
Jens Geyer | 561bc9a | 2022-01-26 22:38:04 +0100 | [diff] [blame] | 28 | /// Interface implemented by server users to handle events from the server |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 29 | /// </summary> |
Jens Geyer | 561bc9a | 2022-01-26 22:38:04 +0100 | [diff] [blame] | 30 | /// <remarks>Replaced by ITServerEventHandler</remarks> |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 31 | // ReSharper disable once InconsistentNaming |
Jens Geyer | 561bc9a | 2022-01-26 22:38:04 +0100 | [diff] [blame] | 32 | #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 Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 40 | { |
| 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 Geyer | 5a17b13 | 2019-05-26 15:53:37 +0200 | [diff] [blame] | 62 | } |