Skip to content

Commit 325b213

Browse files
Copilotrossmills99
andcommitted
Add missing AQL query options to PostCursorOptions
Co-authored-by: rossmills99 <[email protected]>
1 parent 384b31c commit 325b213

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

arangodb-net-standard.Test/CursorApi/CursorApiClientTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,30 @@ public async Task PostCursorAsync_ShouldSucceed_WhenUsingOtherOptions()
155155
Assert.Equal("This is a robbery", response.Result.First().MyProperty);
156156
}
157157

158+
[Fact]
159+
public async Task PostCursorAsync_ShouldSucceed_WhenUsingNewOptions()
160+
{
161+
var response = await _cursorApi.PostCursorAsync<MyModel>(
162+
"FOR doc IN [{ myProperty: CONCAT('This is a ', @testString) }] LIMIT 1 RETURN doc",
163+
new Dictionary<string, object> { ["testString"] = "test" },
164+
new PostCursorOptions
165+
{
166+
AllowDirtyReads = false,
167+
AllowRetry = true,
168+
Cache = false,
169+
FillBlockCache = true,
170+
MaxDNFConditionMembers = 100,
171+
MaxNodesPerCallstack = 200,
172+
MaxNumberOfPlans = 128,
173+
SpillOverThresholdMemoryUsage = 134217728,
174+
SpillOverThresholdNumRows = 5000000,
175+
UsePlanCache = true
176+
});
177+
178+
Assert.Single(response.Result);
179+
Assert.Equal("This is a test", response.Result.First().MyProperty);
180+
}
181+
158182
[Fact]
159183
public async Task PostCursorAsync_ShouldThrow_WhenAqlIsNotValid()
160184
{

arangodb-net-standard/CursorApi/Models/PostCursorOptions.cs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,77 @@ public class PostCursorOptions
119119
/// This feature is only available in the Enterprise Edition.
120120
/// </summary>
121121
public bool? SkipInaccessibleCollections { get; set; }
122+
123+
/// <summary>
124+
/// Set to true to allow reading from followers in a cluster.
125+
/// Available in ArangoDB 3.10.0 onwards.
126+
/// </summary>
127+
public bool? AllowDirtyReads { get; set; }
128+
129+
/// <summary>
130+
/// Set to true to make it possible to retry fetching the latest batch from a cursor.
131+
/// </summary>
132+
public bool? AllowRetry { get; set; }
133+
134+
/// <summary>
135+
/// Flag to determine whether the AQL query results cache shall be used.
136+
/// If set to false, then any query cache lookup will be skipped for the query.
137+
/// If set to true, it will lead to the query cache being checked for the query
138+
/// if the query cache mode is either 'on' or 'demand'.
139+
/// </summary>
140+
public bool? Cache { get; set; }
141+
142+
/// <summary>
143+
/// Whether to fill the in-memory block cache with any data read from storage.
144+
/// If set to false, then any data read is not added to the block cache.
145+
/// Can be used for queries that read a lot of data that is known to be
146+
/// not useful in the cache.
147+
/// </summary>
148+
public bool? FillBlockCache { get; set; }
149+
150+
/// <summary>
151+
/// Maximum number of OR sub-nodes in the internal representation of an AQL query
152+
/// (DNF - disjunctive normal form) for which an index will be used to evaluate
153+
/// a query's filter condition. Above this threshold, the DNF condition will be ignored
154+
/// and use a full collection scan instead.
155+
/// Available in ArangoDB 3.11.0 onwards.
156+
/// </summary>
157+
public long? MaxDNFConditionMembers { get; set; }
158+
159+
/// <summary>
160+
/// Maximum number of calls to a recursive function. If the number of recursive calls
161+
/// exceeds this threshold, the query is aborted with an error.
162+
/// </summary>
163+
public long? MaxNodesPerCallstack { get; set; }
164+
165+
/// <summary>
166+
/// Limits the maximum number of query execution plans that are created by the
167+
/// AQL query optimizer. Use to control the amount of time spent optimizing a query.
168+
/// </summary>
169+
public long? MaxNumberOfPlans { get; set; }
170+
171+
/// <summary>
172+
/// The threshold for the memory usage (in bytes) after which AQL operators will
173+
/// start to spill data to disk instead of keeping everything in RAM. Only certain
174+
/// operations like SORT or COLLECT support spilling to disk.
175+
/// Available in ArangoDB 3.10.0 onwards.
176+
/// </summary>
177+
public long? SpillOverThresholdMemoryUsage { get; set; }
178+
179+
/// <summary>
180+
/// The threshold for the number of rows after which AQL operators will start to
181+
/// spill data to disk instead of keeping everything in RAM. Only certain
182+
/// operations like SORT or COLLECT support spilling to disk.
183+
/// Available in ArangoDB 3.10.0 onwards.
184+
/// </summary>
185+
public long? SpillOverThresholdNumRows { get; set; }
186+
187+
/// <summary>
188+
/// Whether to use the query plan cache. If set to true, the query plan cache will
189+
/// be checked for an existing plan before optimizing the query. If set to false,
190+
/// the query will be optimized without checking the plan cache.
191+
/// Available in ArangoDB 3.12.4 onwards.
192+
/// </summary>
193+
public bool? UsePlanCache { get; set; }
122194
}
123195
}

0 commit comments

Comments
 (0)