Free cookie consent management tool by TermsFeed Policy Generator

source: tags/3.3.4/HeuristicLab.ExtLibs/HeuristicLab.ProtobufCS/0.9.1/ProtobufCS/src/ProtocolBuffers/IService.cs

Last change on this file was 3857, checked in by abeham, 14 years ago

#866

  • Added protobuf-csharp-port project source to ExtLibs
File size: 4.9 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;
36using Google.ProtocolBuffers.Descriptors;
37
38namespace Google.ProtocolBuffers {
39  /// <summary>
40  /// Base interface for protocol-buffer-based RPC services. Services themselves
41  /// are abstract classes (implemented either by servers or as stubs) but they
42  /// implement this itnerface. The methods of this interface can be used to call
43  /// the methods of the service without knowing its exact type at compile time
44  /// (analagous to the IMessage interface).
45  /// </summary>
46  public interface IService {
47    /// <summary>
48    /// The ServiceDescriptor describing this service and its methods.
49    /// </summary>
50    ServiceDescriptor DescriptorForType { get; }
51
52    /// <summary>
53    /// Call a method of the service specified by MethodDescriptor.  This is
54    /// normally implemented as a simple switch that calls the standard
55    /// definitions of the service's methods.
56    /// <para>
57    /// Preconditions
58    /// <list>
59    /// <item><c>method.Service == DescriptorForType</c></item>
60    /// <item>request is of the exact same class as the object returned by GetRequestPrototype(method)</item>
61    /// <item>controller is of the correct type for the RPC implementation being used by this service.
62    /// For stubs, the "correct type" depends on the IRpcChannel which the stub is using. Server-side
63    /// implementations are expected to accept whatever type of IRpcController the server-side RPC implementation
64    /// uses.</item>
65    /// </list>
66    /// </para>
67    /// <para>
68    /// Postconditions
69    /// <list>
70    /// <item><paramref name="done" /> will be called when the method is complete.
71    /// This may before CallMethod returns or it may be at some point in the future.</item>
72    /// <item>The parameter to <paramref name="done"/> is the response. It will be of the
73    /// exact same type as would be returned by <see cref="GetResponsePrototype"/>.</item>
74    /// <item>If the RPC failed, the parameter to <paramref name="done"/> will be null.
75    /// Further details about the failure can be found by querying <paramref name="controller"/>.</item>
76    /// </list>
77    /// </para>
78    /// </summary>
79    void CallMethod(MethodDescriptor method, IRpcController controller,
80                    IMessage request, Action<IMessage> done);
81
82    /// <summary>
83    /// CallMethod requires that the request passed in is of a particular implementation
84    /// of IMessage. This method gets the default instance of this type of a given method.
85    /// You can then call WeakCreateBuilderForType to create a builder to build an object which
86    /// you can then pass to CallMethod.
87    /// </summary>
88    IMessage GetRequestPrototype(MethodDescriptor method);
89
90    /// <summary>
91    /// Like GetRequestPrototype, but returns a prototype of the response message.
92    /// This is generally not needed because the IService implementation contructs
93    /// the response message itself, but it may be useful in some cases to know ahead
94    /// of time what type of object will be returned.
95    /// </summary>
96    IMessage GetResponsePrototype(MethodDescriptor method);
97  }
98}
Note: See TracBrowser for help on using the repository browser.