Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GP-MoveOperators/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/2.4.1/ProtobufCS/src/ProtocolBuffers/IRpcController.cs @ 8660

Last change on this file since 8660 was 8295, checked in by abeham, 12 years ago

#1897:

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