| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | namespace IceRpc.Transports.Coloc; |
| | | 4 | | |
| | | 5 | | /// <summary>A property bag used to configure a <see cref="ColocTransport" />.</summary> |
| | | 6 | | public sealed record class ColocTransportOptions |
| | | 7 | | { |
| | | 8 | | /// <summary>Gets or sets the maximum length of the pending connections queue.</summary> |
| | | 9 | | /// <value>The maximum queue length. The value cannot be less than <c>1</c>. Defaults to <c>511</c>.</value> |
| | | 10 | | public int ListenBacklog |
| | | 11 | | { |
| | 575 | 12 | | get => _listenBacklog; |
| | 7 | 13 | | set => _listenBacklog = value >= 1 ? value : |
| | 7 | 14 | | throw new ArgumentOutOfRangeException( |
| | 7 | 15 | | nameof(value), |
| | 7 | 16 | | $"Invalid value '{value}' for {nameof(ListenBacklog)}, it cannot be less than 1."); |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <summary>Gets or sets the number of bytes in the Coloc connection when <see cref="IDuplexConnection.WriteAsync" |
| | | 20 | | /// /> starts blocking.</summary> |
| | | 21 | | /// <value>The pause writer threshold. The value cannot be less than <c>1</c> KB. Defaults to <c>64</c> KB.</value> |
| | | 22 | | public int PauseWriterThreshold |
| | | 23 | | { |
| | 1727 | 24 | | get => _pauseWriterThreshold; |
| | 3 | 25 | | set => _pauseWriterThreshold = value >= 1024 ? value : |
| | 3 | 26 | | throw new ArgumentOutOfRangeException( |
| | 3 | 27 | | nameof(value), |
| | 3 | 28 | | $"Invalid value '{value}' for {nameof(PauseWriterThreshold)}, it cannot be less than 1KB."); |
| | | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary>Gets or sets the number of bytes in the Coloc connection when <see cref="IDuplexConnection.WriteAsync" |
| | | 32 | | /// /> stops blocking.</summary> |
| | | 33 | | /// <value>The resume writer threshold. The value cannot be less than <c>1</c> KB and cannot be greater than <see |
| | | 34 | | /// cref="PauseWriterThreshold"/>. Defaults to <c>32</c> KB.</value> |
| | | 35 | | public int ResumeWriterThreshold |
| | | 36 | | { |
| | 1727 | 37 | | get => _resumeWriterThreshold; |
| | 3 | 38 | | set => _resumeWriterThreshold = value >= 1024 ? value : |
| | 3 | 39 | | throw new ArgumentOutOfRangeException( |
| | 3 | 40 | | nameof(value), |
| | 3 | 41 | | $"Invalid value '{value}' for {nameof(ResumeWriterThreshold)}, it cannot be less than 1KB."); |
| | | 42 | | } |
| | | 43 | | |
| | 568 | 44 | | private int _listenBacklog = 511; |
| | 568 | 45 | | private int _pauseWriterThreshold = 65536; |
| | 568 | 46 | | private int _resumeWriterThreshold = 32768; |
| | | 47 | | } |