Table of Contents

Class StaticConnectionPool

Namespace
Elasticsearch.Net
Assembly
Elasticsearch.Net.dll
public class StaticConnectionPool : IConnectionPool, IDisposable
Inheritance
StaticConnectionPool
Implements
Derived
Inherited Members

Constructors

StaticConnectionPool(IEnumerable<Node>, bool, IDateTimeProvider)

public StaticConnectionPool(IEnumerable<Node> nodes, bool randomize = true, IDateTimeProvider dateTimeProvider = null)

Parameters

nodes IEnumerable<Node>
randomize bool
dateTimeProvider IDateTimeProvider

StaticConnectionPool(IEnumerable<Node>, Func<Node, float>, IDateTimeProvider)

protected StaticConnectionPool(IEnumerable<Node> nodes, Func<Node, float> nodeScorer, IDateTimeProvider dateTimeProvider = null)

Parameters

nodes IEnumerable<Node>
nodeScorer Func<Node, float>
dateTimeProvider IDateTimeProvider

StaticConnectionPool(IEnumerable<Uri>, bool, IDateTimeProvider)

public StaticConnectionPool(IEnumerable<Uri> uris, bool randomize = true, IDateTimeProvider dateTimeProvider = null)

Parameters

uris IEnumerable<Uri>
randomize bool
dateTimeProvider IDateTimeProvider

Fields

GlobalCursor

protected int GlobalCursor

Field Value

int

Properties

AliveNodes

protected List<Node> AliveNodes { get; }

Property Value

List<Node>

DateTimeProvider

protected IDateTimeProvider DateTimeProvider { get; }

Property Value

IDateTimeProvider

InternalNodes

protected List<Node> InternalNodes { get; set; }

Property Value

List<Node>

LastUpdate

public DateTime LastUpdate { get; protected set; }

Property Value

DateTime

MaxRetries

Returns the default maximum retries for the connection pool implementation. Most implementation default to number of nodes, note that this can be overidden in the connection settings

public int MaxRetries { get; }

Property Value

int

Nodes

Returns a readonly constant view of all the nodes in the cluster, this might involve creating copies of the nodes e.g if you are using the sniffing connectionpool. If you do not need an isolated copy of the nodes please read CreateView(Action<AuditEvent, Node>) to completion

public virtual IReadOnlyCollection<Node> Nodes { get; }

Property Value

IReadOnlyCollection<Node>

Random

protected Random Random { get; }

Property Value

Random

Randomize

protected bool Randomize { get; }

Property Value

bool

SniffedOnStartup

Bookkeeps wheter this connectionpool has seen a sniff on startup. its up to to the callee to set this in a threadsafe fashion

public bool SniffedOnStartup { get; set; }

Property Value

bool

SupportsPinging

public virtual bool SupportsPinging { get; }

Property Value

bool

SupportsReseeding

Signals that this implemenation can accept new nodes

public virtual bool SupportsReseeding { get; }

Property Value

bool

UsingSsl

Whether or not SSL is being using

public bool UsingSsl { get; }

Property Value

bool

Methods

CreateView(Action<AuditEvent, Node>)

Creates a view of all the live nodes with changing starting positions that wraps over on each call e.g Thread A might get 1,2,3,4,5 and thread B will get 2,3,4,5,1. if there are no live nodes yields a different dead node to try once

public virtual IEnumerable<Node> CreateView(Action<AuditEvent, Node> audit = null)

Parameters

audit Action<AuditEvent, Node>

Returns

IEnumerable<Node>

DisposeManagedResources()

protected virtual void DisposeManagedResources()

Reseed(IEnumerable<Node>)

Update the node list, it's the IConnectionPool's responsibility to do so in a threadsafe fashion

public virtual void Reseed(IEnumerable<Node> nodes)

Parameters

nodes IEnumerable<Node>

RetryInternalNodes(int, Action<AuditEvent, Node>)

protected virtual Node RetryInternalNodes(int globalCursor, Action<AuditEvent, Node> audit = null)

Parameters

globalCursor int
audit Action<AuditEvent, Node>

Returns

Node

SelectAliveNodes(int, List<Node>, Action<AuditEvent, Node>)

protected virtual IEnumerable<Node> SelectAliveNodes(int cursor, List<Node> aliveNodes, Action<AuditEvent, Node> audit = null)

Parameters

cursor int
aliveNodes List<Node>
audit Action<AuditEvent, Node>

Returns

IEnumerable<Node>

SortNodes(IEnumerable<Node>)

protected IOrderedEnumerable<Node> SortNodes(IEnumerable<Node> nodes)

Parameters

nodes IEnumerable<Node>

Returns

IOrderedEnumerable<Node>