blob: f99a6a0631e33244b5e2afa9b48178278ebfa44a [file] [log] [blame]
Jan Tattermuschbff90ac2015-08-06 21:30:26 -07001#region Copyright notice and license
2
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003// Copyright 2015-2016 gRPC authors.
Jan Tattermuschbff90ac2015-08-06 21:30:26 -07004//
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005// 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
Jan Tattermuschbff90ac2015-08-06 21:30:26 -07008//
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009// http://www.apache.org/licenses/LICENSE-2.0
Jan Tattermuschbff90ac2015-08-06 21:30:26 -070010//
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011// 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.
Jan Tattermuschbff90ac2015-08-06 21:30:26 -070016
17#endregion
18
19using System;
20
21namespace Grpc.Core
22{
23 /// <summary>
24 /// Flags for write operations.
25 /// </summary>
26 [Flags]
27 public enum WriteFlags
28 {
29 /// <summary>
30 /// Hint that the write may be buffered and need not go out on the wire immediately.
31 /// gRPC is free to buffer the message until the next non-buffered
32 /// write, or until write stream completion, but it need not buffer completely or at all.
33 /// </summary>
34 BufferHint = 0x1,
35
36 /// <summary>
37 /// Force compression to be disabled for a particular write.
38 /// </summary>
39 NoCompress = 0x2
40 }
41
Jan Tattermuschbff90ac2015-08-06 21:30:26 -070042 /// <summary>
43 /// Options for write operations.
44 /// </summary>
45 public class WriteOptions
46 {
47 /// <summary>
48 /// Default write options.
49 /// </summary>
50 public static readonly WriteOptions Default = new WriteOptions();
51
Chris Bacon75743ef2016-03-14 15:10:44 +000052 private readonly WriteFlags flags;
Jan Tattermuschbff90ac2015-08-06 21:30:26 -070053
Jan Tattermusch12855fc2015-08-24 16:43:23 -070054 /// <summary>
55 /// Initializes a new instance of <c>WriteOptions</c> class.
56 /// </summary>
57 /// <param name="flags">The write flags.</param>
Jan Tattermuschbff90ac2015-08-06 21:30:26 -070058 public WriteOptions(WriteFlags flags = default(WriteFlags))
59 {
60 this.flags = flags;
61 }
62
Jan Tattermusch12855fc2015-08-24 16:43:23 -070063 /// <summary>
64 /// Gets the write flags.
65 /// </summary>
Jan Tattermuschbff90ac2015-08-06 21:30:26 -070066 public WriteFlags Flags
67 {
68 get
69 {
70 return this.flags;
71 }
72 }
73 }
74}