| Index: third_party/grpc/src/csharp/Grpc.Core/WriteOptions.cs
|
| diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs b/third_party/grpc/src/csharp/Grpc.Core/WriteOptions.cs
|
| similarity index 58%
|
| copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
|
| copy to third_party/grpc/src/csharp/Grpc.Core/WriteOptions.cs
|
| index cfe56fde671e4ae025b7be94d831cbe4621795e6..7523ada84a8ee33b1af4a6e1bcd82ce9069a7083 100644
|
| --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/IFieldAccessor.cs
|
| +++ b/third_party/grpc/src/csharp/Grpc.Core/WriteOptions.cs
|
| @@ -1,7 +1,7 @@
|
| #region Copyright notice and license
|
| -// Protocol Buffers - Google's data interchange format
|
| -// Copyright 2008 Google Inc. All rights reserved.
|
| -// https://developers.google.com/protocol-buffers/
|
| +
|
| +// Copyright 2015, Google Inc.
|
| +// All rights reserved.
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,44 +28,62 @@
|
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| +
|
| #endregion
|
|
|
| using System;
|
| -using System.Collections;
|
|
|
| -namespace Google.Protobuf.Reflection
|
| +namespace Grpc.Core
|
| {
|
| /// <summary>
|
| - /// Allows fields to be reflectively accessed.
|
| + /// Flags for write operations.
|
| /// </summary>
|
| - public interface IFieldAccessor
|
| + [Flags]
|
| + public enum WriteFlags
|
| {
|
| /// <summary>
|
| - /// Returns the descriptor associated with this field.
|
| + /// Hint that the write may be buffered and need not go out on the wire immediately.
|
| + /// gRPC is free to buffer the message until the next non-buffered
|
| + /// write, or until write stream completion, but it need not buffer completely or at all.
|
| /// </summary>
|
| - FieldDescriptor Descriptor { get; }
|
| + BufferHint = 0x1,
|
|
|
| /// <summary>
|
| - /// Clears the field in the specified message. (For repeated fields,
|
| - /// this clears the list.)
|
| + /// Force compression to be disabled for a particular write.
|
| + /// </summary>
|
| + NoCompress = 0x2
|
| + }
|
| +
|
| + /// <summary>
|
| + /// Options for write operations.
|
| + /// </summary>
|
| + public class WriteOptions
|
| + {
|
| + /// <summary>
|
| + /// Default write options.
|
| /// </summary>
|
| - void Clear(IMessage message);
|
| + public static readonly WriteOptions Default = new WriteOptions();
|
| +
|
| + private WriteFlags flags;
|
|
|
| /// <summary>
|
| - /// Fetches the field value. For repeated values, this will be an
|
| - /// <see cref="IList"/> implementation. For map values, this will be an
|
| - /// <see cref="IDictionary"/> implementation.
|
| + /// Initializes a new instance of <c>WriteOptions</c> class.
|
| /// </summary>
|
| - object GetValue(IMessage message);
|
| + /// <param name="flags">The write flags.</param>
|
| + public WriteOptions(WriteFlags flags = default(WriteFlags))
|
| + {
|
| + this.flags = flags;
|
| + }
|
|
|
| /// <summary>
|
| - /// Mutator for single "simple" fields only.
|
| + /// Gets the write flags.
|
| /// </summary>
|
| - /// <remarks>
|
| - /// Repeated fields are mutated by fetching the value and manipulating it as a list.
|
| - /// Map fields are mutated by fetching the value and manipulating it as a dictionary.
|
| - /// </remarks>
|
| - /// <exception cref="InvalidOperationException">The field is not a "simple" field.</exception>
|
| - void SetValue(IMessage message, object value);
|
| + public WriteFlags Flags
|
| + {
|
| + get
|
| + {
|
| + return this.flags;
|
| + }
|
| + }
|
| }
|
| -}
|
| +}
|
|
|