Kinetica   C#   API  Version 7.2.3.1
WorkerList Class Reference

A list of worker URLs to use for multi-head operations. More...

Inherits IReadOnlyList< Uri?>.

Public Member Functions

 WorkerList ()
 Creates an empty WorkerList that can be populated manually with worker URLs to support multi-head operations. More...
 
 WorkerList? (Kinetica db)
 Creates a WorkerList and automatically populates it with the worker URLs from Kinetica to support multi-head operations. More...
 
 WorkerList (Kinetica db, Regex? ip_regex)
 Creates a WorkerList and automatically populates it with the worker URLs from Kinetica to support multi-head operations. More...
 
void Add (Uri url)
 Adds a URL to the worker list. More...
 
void AddOrNull (Uri? url)
 Adds a URL or null (for removed rank) to the worker list. More...
 
void Clear ()
 Clears all URLs from the worker list. More...
 
IEnumerable< Uri > GetActiveUrls ()
 Gets all active (non-null) URLs in the worker list. More...
 
List< string > ToUrlStrings ()
 Converts the worker list to a list of URL strings. More...
 
Uri? Get (int index)
 Gets the URL at the specified index, or null if the rank was removed or index is out of bounds. More...
 
IEnumerator< Uri?> GetEnumerator ()
 Returns an enumerator that iterates through the worker URLs. More...
 
IEnumerable< Uri > GetActiveUrlsEnumerator ()
 Returns an enumerator that iterates through only active (non-null) worker URLs. More...
 

Static Public Member Functions

static WorkerList FromUrls (IEnumerable< Uri > urls)
 Creates a WorkerList from explicit URLs. More...
 
static WorkerList WithIpPrefix (Kinetica db, string? ip_prefix)
 Creates a WorkerList and automatically populates it with the worker URLs from Kinetica, filtering by IP prefix. More...
 

Public Attributes

int Count => _urls.Count
 Gets the number of workers in the list (including removed ranks). More...
 
Uri? this[int index] => index >= 0 && index < _urls.Count ? _urls[index] : null
 Gets the URL at the specified index. More...
 
bool IsEmpty => _urls.Count == 0
 Returns whether the worker list is empty. More...
 
int ActiveCount => _urls.Count(u => u != null)
 Gets the number of active (non-null) workers in the list. More...
 

Properties

bool IsMultiHeadEnabled [get]
 Whether multi-head I/O is enabled on the server. More...
 
Regex? IpRegex [get]
 The IP regex used to filter worker URLs, if one was specified. More...
 
bool IsQueriedUrlList [get]
 Whether this worker list was created by querying the server. More...
 

Detailed Description

A list of worker URLs to use for multi-head operations.

This class contains the URLs of worker nodes in a Kinetica cluster for direct multi-head ingest/retrieval operations. Worker URLs are stored in rank order, starting with rank 1, and all worker ranks must be included; otherwise operations may fail for certain data types.

Note: Some ranks may be "removed" (represented as null entries). Use GetActiveUrls or iterate with null checks when processing workers.

Definition at line 20 of file WorkerList.cs.

Constructor & Destructor Documentation

◆ WorkerList() [1/2]

WorkerList.WorkerList ( )
inline

Creates an empty WorkerList that can be populated manually with worker URLs to support multi-head operations.

Note that worker URLs must be added in rank order, starting with rank 1, and all worker ranks must be included; otherwise operations may fail for certain data types.

Definition at line 58 of file WorkerList.cs.

◆ WorkerList() [2/2]

WorkerList.WorkerList ( Kinetica  db,
Regex?  ip_regex 
)
inline

Creates a WorkerList and automatically populates it with the worker URLs from Kinetica to support multi-head operations.

If the specified Kinetica instance has multi-head operations disabled, the worker list will be empty and multi-head operations will not be used.

Note that in some cases, workers may be configured to use more than one IP address, not all of which may be accessible to the client; the optional ip_regex parameter can be used in such cases to filter for an IP range that is accessible, e.g., a regex of 192.168..* will use worker IP addresses in the 192.168.* range.

Parameters
dbThe Kinetica instance from which to obtain the worker URLs.
ip_regexOptional IP regex to match.

Definition at line 100 of file WorkerList.cs.

Member Function Documentation

◆ Add()

void WorkerList.Add ( Uri  url)
inline

Adds a URL to the worker list.

Parameters
urlThe URL to add.

Definition at line 328 of file WorkerList.cs.

◆ AddOrNull()

void WorkerList.AddOrNull ( Uri?  url)
inline

Adds a URL or null (for removed rank) to the worker list.

Parameters
urlThe URL to add, or null for a removed rank.

Definition at line 337 of file WorkerList.cs.

◆ Clear()

void WorkerList.Clear ( )
inline

Clears all URLs from the worker list.

Definition at line 345 of file WorkerList.cs.

◆ FromUrls()

static WorkerList WorkerList.FromUrls ( IEnumerable< Uri >  urls)
inlinestatic

Creates a WorkerList from explicit URLs.

Parameters
urlsList of URLs to use for worker ranks.
Returns
A new WorkerList containing the specified URLs.

Definition at line 155 of file WorkerList.cs.

◆ Get()

Uri? WorkerList.Get ( int  index)
inline

Gets the URL at the specified index, or null if the rank was removed or index is out of bounds.

Parameters
indexThe index of the worker URL to get (0-based, corresponds to rank-1).
Returns
The URL at the specified index, or null.

Definition at line 390 of file WorkerList.cs.

◆ GetActiveUrls()

IEnumerable<Uri> WorkerList.GetActiveUrls ( )
inline

Gets all active (non-null) URLs in the worker list.

Returns
An enumerable of active worker URLs.

Definition at line 361 of file WorkerList.cs.

◆ GetActiveUrlsEnumerator()

IEnumerable<Uri> WorkerList.GetActiveUrlsEnumerator ( )
inline

Returns an enumerator that iterates through only active (non-null) worker URLs.

This provides backward compatibility with code that expects to iterate over a List<Uri>.

Definition at line 418 of file WorkerList.cs.

◆ GetEnumerator()

IEnumerator<Uri?> WorkerList.GetEnumerator ( )
inline

Returns an enumerator that iterates through the worker URLs.

Note: May include null entries for removed ranks.

Definition at line 401 of file WorkerList.cs.

◆ ToUrlStrings()

List<string> WorkerList.ToUrlStrings ( )
inline

Converts the worker list to a list of URL strings.

Only includes active (non-null) URLs.

Returns
A list of URL strings for all active workers.

Definition at line 376 of file WorkerList.cs.

◆ WithIpPrefix()

static WorkerList WorkerList.WithIpPrefix ( Kinetica  db,
string?  ip_prefix 
)
inlinestatic

Creates a WorkerList and automatically populates it with the worker URLs from Kinetica, filtering by IP prefix.

The ip_prefix parameter can be used to filter for an IP range that is accessible, e.g., a prefix of 192.168. will use worker IP addresses in the 192.168.* range.

Parameters
dbThe Kinetica instance from which to obtain the worker URLs.
ip_prefixIP prefix to match (e.g., "192.168.").
Returns
A new WorkerList containing matching worker URLs.

Definition at line 177 of file WorkerList.cs.

◆ WorkerList?()

Creates a WorkerList and automatically populates it with the worker URLs from Kinetica to support multi-head operations.

If the specified Kinetica instance has multi-head operations disabled, the worker list will be empty and multi-head operations will not be used.

Note that in some cases, workers may be configured to use more than one IP address, not all of which may be accessible to the client; this constructor uses the first IP returned by the server for each worker. To override this behavior, use the overload with an IP regex parameter.

Parameters
dbThe Kinetica instance from which to obtain the worker URLs.

Definition at line 80 of file WorkerList.cs.

Member Data Documentation

◆ ActiveCount

int WorkerList.ActiveCount => _urls.Count(u => u != null)

Gets the number of active (non-null) workers in the list.

Definition at line 369 of file WorkerList.cs.

◆ Count

int WorkerList.Count => _urls.Count

Gets the number of workers in the list (including removed ranks).

Definition at line 42 of file WorkerList.cs.

◆ IsEmpty

bool WorkerList.IsEmpty => _urls.Count == 0

Returns whether the worker list is empty.

Definition at line 355 of file WorkerList.cs.

◆ this[int index]

Uri? WorkerList.this[int index] => index >= 0 && index < _urls.Count ? _urls[index] : null

Gets the URL at the specified index.

Returns null if the rank was removed or index is out of bounds.

Definition at line 48 of file WorkerList.cs.

Property Documentation

◆ IpRegex

Regex? WorkerList.IpRegex
get

The IP regex used to filter worker URLs, if one was specified.

Definition at line 32 of file WorkerList.cs.

◆ IsMultiHeadEnabled

bool WorkerList.IsMultiHeadEnabled
get

Whether multi-head I/O is enabled on the server.

Definition at line 27 of file WorkerList.cs.

◆ IsQueriedUrlList

bool WorkerList.IsQueriedUrlList
get

Whether this worker list was created by querying the server.

Definition at line 37 of file WorkerList.cs.


The documentation for this class was generated from the following file: