Class ScyllaDeque<T>.Builder
Fluent builder for constructing ScyllaDeque<T> instances with a readable, named-parameter-style configuration API.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public sealed class ScyllaDeque<T>.Builder
Remarks
Obtain a builder by calling CreateBuilder(). Chain configuration methods and finish with either Build() (returns the IScyllaCollection<T> interface, covering both synchronized and unsynchronized variants) or BuildConcrete() (returns the concrete ScyllaDeque<T> type directly, but throws if Synchronized(object) was called).
Default settings when no configuration methods are called: initial capacity of
4 (Scylla.Core.Structures.ScyllaDeque<T>.DEFAULT_CAPACITY), auto-growing, unsynchronized.
// Basic usage - auto-growing deque with defaults
var deque = ScyllaDeque<int>.CreateBuilder().Build();
// Fixed-capacity deque
var deque = ScyllaDeque<string>.CreateBuilder()
.WithCapacity(64)
.FixedCapacity()
.Build();
// Synchronized thread-safe wrapper
var deque = ScyllaDeque<Task>.CreateBuilder()
.WithCapacity(128)
.Synchronized()
.Build();
Methods
Build()
Constructs the configured deque and returns it as IScyllaCollection<T>. If Synchronized(object) was called, the returned instance is a ScyllaDeque<T>.SynchronizedScyllaDeque wrapper; otherwise it is the raw ScyllaDeque<T>.
Declaration
public IScyllaCollection<T> Build()
Returns
| Type | Description |
|---|---|
| IScyllaCollection<T> | An IScyllaCollection<T> representing either the unsynchronized deque or its synchronized wrapper, depending on whether Synchronized(object) was called. |
BuildConcrete()
Constructs the configured deque and returns the concrete ScyllaDeque<T> type directly, bypassing the IScyllaCollection<T> interface.
Declaration
public ScyllaDeque<T> BuildConcrete()
Returns
| Type | Description |
|---|---|
| ScyllaDeque<T> | The newly constructed, unsynchronized ScyllaDeque<T> instance. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when Synchronized(object) was called on this builder, because the resulting instance would be a ScyllaDeque<T>.SynchronizedScyllaDeque, which cannot be represented as ScyllaDeque<T>. Use Build() in that case to obtain the IScyllaCollection<T> interface instead. |
FixedCapacity(bool)
Enables or disables fixed-capacity mode on the deque being built.
When enabled, the backing buffer will not grow beyond the capacity specified by
WithCapacity(int), and push operations return false when full.
Declaration
public ScyllaDeque<T>.Builder FixedCapacity(bool value = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | value |
|
Returns
| Type | Description |
|---|---|
| ScyllaDeque<T>.Builder | This builder instance for method chaining. |
Synchronized(object)
Configures Build() to return a ScyllaDeque<T>.SynchronizedScyllaDeque wrapper that protects every operation on the deque with a lock.
Declaration
public ScyllaDeque<T>.Builder Synchronized(object syncRoot = null)
Parameters
| Type | Name | Description |
|---|---|---|
| object | syncRoot | An optional external lock object. If |
Returns
| Type | Description |
|---|---|
| ScyllaDeque<T>.Builder | This builder instance for method chaining. |
WithCapacity(int)
Sets the initial capacity of the deque's backing circular buffer.
Declaration
public ScyllaDeque<T>.Builder WithCapacity(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capacity | The desired initial capacity. Must be at least |
Returns
| Type | Description |
|---|---|
| ScyllaDeque<T>.Builder | This builder instance for method chaining. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when |