Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/0.9.1/ProtobufCS/src/ProtocolBuffers/IRpcController.cs @ 5370

Last change on this file since 5370 was 3857, checked in by abeham, 15 years ago

#866

  • Added protobuf-csharp-port project source to ExtLibs
File size: 5.3 KB
Line 
1#region Copyright notice and license
2// Protocol Buffers - Google's data interchange format
3// Copyright 2008 Google Inc.  All rights reserved.
4// http://github.com/jskeet/dotnet-protobufs/
5// Original C++/Java/Python code:
6// http://code.google.com/p/protobuf/
7//
8// Redistribution and use in source and binary forms, with or without
9// modification, are permitted provided that the following conditions are
10// met:
11//
12//     * Redistributions of source code must retain the above copyright
13// notice, this list of conditions and the following disclaimer.
14//     * Redistributions in binary form must reproduce the above
15// copyright notice, this list of conditions and the following disclaimer
16// in the documentation and/or other materials provided with the
17// distribution.
18//     * Neither the name of Google Inc. nor the names of its
19// contributors may be used to endorse or promote products derived from
20// this software without specific prior written permission.
21//
22// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#endregion
34
35using System;
36
37namespace Google.ProtocolBuffers {
38  /// <summary>
39  /// Mediates a single method call. The primary purpose of the controller
40  /// is to provide a way to manipulate settings specific to the
41  /// RPC implementation and to find out about RPC-level errors.
42  ///
43  /// The methods provided by this interface are intended to be a "least
44  /// common denominator" set of features which we expect all implementations to
45  /// support. Specific implementations may provide more advanced features,
46  /// (e.g. deadline propagation).
47  /// </summary>
48  public interface IRpcController {
49
50    #region Client side calls
51    // These calls may be made from the client side only.  Their results
52    // are undefined on the server side (may throw exceptions).
53
54    /// <summary>
55    /// Resets the controller to its initial state so that it may be reused in
56    /// a new call.  This can be called from the client side only.  It must not
57    /// be called while an RPC is in progress.
58    /// </summary>
59    void Reset();
60
61    /// <summary>
62    /// After a call has finished, returns true if the call failed.  The possible
63    /// reasons for failure depend on the RPC implementation. Failed must
64    /// only be called on the client side, and must not be called before a call has
65    /// finished.
66    /// </summary>
67    bool Failed { get; }
68
69    /// <summary>
70    /// If Failed is true, ErrorText returns a human-readable description of the error.
71    /// </summary>
72    string ErrorText { get; }
73
74    /// <summary>
75    /// Advises the RPC system that the caller desires that the RPC call be
76    /// canceled. The RPC system may cancel it immediately, may wait awhile and
77    /// then cancel it, or may not even cancel the call at all. If the call is
78    /// canceled, the "done" callback will still be called and the RpcController
79    /// will indicate that the call failed at that time.
80    /// </summary>
81    void StartCancel();
82    #endregion
83
84    #region Server side calls
85    // These calls may be made from the server side only.  Their results
86    // are undefined on the client side (may throw exceptions).
87
88    /// <summary>
89    /// Causes Failed to return true on the client side. <paramref name="reason"/>
90    /// will be incorporated into the message returned by ErrorText.
91    /// If you find you need to return machine-readable information about
92    /// failures, you should incorporate it into your response protocol buffer
93    /// and should *not* call SetFailed.
94    /// </summary>
95    void SetFailed(string reason);
96
97    /// <summary>
98    /// If true, indicates that the client canceled the RPC, so the server may as
99    /// well give up on replying to it. This method must be called on the server
100    /// side only. The server should still call the final "done" callback.
101    /// </summary>
102    bool isCanceled();
103
104    /// <summary>
105    /// Requests that the given callback be called when the RPC is canceled.
106    /// The parameter passed to the callback will always be null. The callback will
107    /// be called exactly once. If the RPC completes without being canceled, the
108    /// callback will be called after completion. If the RPC has already been canceled
109    /// when NotifyOnCancel is called, the callback will be called immediately.
110    ///
111    /// NotifyOnCancel must be called no more than once per request. It must be
112    /// called on the server side only.
113    /// </summary>
114    /// <param name="callback"></param>
115    void NotifyOnCancel(Action<object> callback);
116    #endregion
117  }
118}
Note: See TracBrowser for help on using the repository browser.