Class Watcher<T>
Implements
Inherited Members
Namespace: k8s
Assembly: KubernetesClient.dll
Syntax
public class Watcher<T> : IDisposable
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
View SourceWatcher(Func<Task<StreamReader>>, Action<WatchEventType, T>, Action<Exception>, Action)
Initializes a new instance of the Watcher<T> class.
Declaration
public Watcher(Func<Task<StreamReader>> streamReaderCreator, Action<WatchEventType, T> onEvent, Action<Exception> onError, Action onClosed = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Task<StreamReader>> | streamReaderCreator | A StreamReader from which to read the events. |
| Action<WatchEventType, T> | onEvent | The action to invoke when the server sends a new event. |
| Action<Exception> | onError | The action to invoke when an error occurs. |
| Action | onClosed | The action to invoke when the server closes the connection. |
Watcher(Func<Task<TextReader>>, Action<WatchEventType, T>, Action<Exception>, Action)
Initializes a new instance of the Watcher<T> class.
Declaration
public Watcher(Func<Task<TextReader>> streamReaderCreator, Action<WatchEventType, T> onEvent, Action<Exception> onError, Action onClosed = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Task<TextReader>> | streamReaderCreator | A TextReader from which to read the events. |
| Action<WatchEventType, T> | onEvent | The action to invoke when the server sends a new event. |
| Action<Exception> | onError | The action to invoke when an error occurs. |
| Action | onClosed | The action to invoke when the server closes the connection. |
Properties
View SourceWatching
indicate if the watch object is alive
Declaration
public bool Watching { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceDispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Events
View SourceOnClosed
The event which is raised when the server closes the connection.
Declaration
public event Action OnClosed
Event Type
| Type | Description |
|---|---|
| Action |
OnError
add/remove callbacks when any exception was caught during watching
Declaration
public event Action<Exception> OnError
Event Type
| Type | Description |
|---|---|
| Action<Exception> |
OnEvent
add/remove callbacks when any event raised from api server
Declaration
public event Action<WatchEventType, T> OnEvent
Event Type
| Type | Description |
|---|---|
| Action<WatchEventType, T> |