IRpcChannel.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc.
  3. // http://code.google.com/p/protobuf/
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // 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, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. using System;
  17. using Google.ProtocolBuffers.Descriptors;
  18. namespace Google.ProtocolBuffers {
  19. /// <summary>
  20. /// Interface for an RPC channel. A channel represents a communication line to
  21. /// a service (IService implementation) which can be used to call that service's
  22. /// methods. The service may be running on another machine. Normally, you should
  23. /// not call an IRpcChannel directly, but instead construct a stub wrapping it.
  24. /// Generated service classes contain a CreateStub method for precisely this purpose.
  25. /// </summary>
  26. public interface IRpcChannel {
  27. /// <summary>
  28. /// Calls the given method of the remote service. This method is similar
  29. /// to <see cref="IService.CallMethod" /> with one important difference: the
  30. /// caller decides the types of the IMessage objects, not the implementation.
  31. /// The request may be of any type as long as <c>request.Descriptor == method.InputType</c>.
  32. /// The response passed to the callback will be of the same type as
  33. /// <paramref name="responsePrototype"/> (which must be such that
  34. /// <c>responsePrototype.Descriptor == method.OutputType</c>).
  35. /// </summary>
  36. void CallMethod(MethodDescriptor method, IRpcController controller,
  37. IMessage request, IMessage responsePrototype, Action<IMessage> done);
  38. }
  39. }