107 logger.LogTrace(
"Created.");
127 Logger.LogTrace(
"Disposed");
137 Logger.LogTrace(
"Disconnecting...");
139 Logger.LogTrace(
"Disconnected");
241 Logger.LogTrace(
"Requesting channel remap...");
256 Logger.LogTrace(
"StopReconnectionTimer");
268 Logger.LogTrace(
"Timer wasn't running");
270 return Task.CompletedTask;
303 Logger.LogTrace(
"Disconnecting...");
307 Logger.LogTrace(
"Already disconnected not doing disconnection attempt!");
309 Logger.LogTrace(
"Connecting...");
311 Logger.LogTrace(
"Connected successfully");
328 Logger.LogTrace(
e,
"ReconnectionLoop cancelled");
332 Logger.LogError(
e,
"Error reconnecting!");
337 Logger.LogTrace(
"ReconnectionLoop exiting...");
Represents a message received by a IProvider.
ValueTask Connect(CancellationToken cancellationToken)
Attempt to connect the Provider.
bool Disposed
If the IProvider was disposed.
Task StopReconnectionTimer()
Stops and awaits the reconnectTask.
async ValueTask Disconnect(CancellationToken cancellationToken)
Gracefully disconnects the provider. Permanently stops the reconnection timer.A ValueTask representin...
ValueTask DisconnectImpl(CancellationToken cancellationToken)
Gracefully disconnects the provider.
Provider(IJobManager jobManager, IAsyncDelayer asyncDelayer, ILogger< Provider > logger, ChatBot chatBot)
Initializes a new instance of the Provider class.
ValueTask< Dictionary< ChatChannel, IEnumerable< ChannelRepresentation > > > MapChannelsImpl(IEnumerable< ChatChannel > channels, CancellationToken cancellationToken)
Implementation of MapChannels(IEnumerable<ChatChannel>, CancellationToken).
async Task< Message?> NextMessage(CancellationToken cancellationToken)
Get a Task<TResult> resulting in the next Message the IProvider receives or null on a disconnect....
void EnqueueMessage(Message? message)
Queues a message for NextMessage(CancellationToken).
bool Connected
If the IProvider is currently connected.
readonly Queue< Message?> messageQueue
Queue<T> of received Messages.
readonly TaskCompletionSource initialConnectionTcs
The backing TaskCompletionSource for InitialConnectionJob.
static string GetEngineCompilerPrefix(Api.Models.EngineType engineType)
Get the prefix for messages about deployments.
TaskCompletionSource nextMessage
TaskCompletionSource that completes while messageQueue isn't empty.
Task InitialConnectionJob
A Task that completes once the IProvider finishes it's first connection attempt regardless of success...
CancellationTokenSource? reconnectCts
CancellationTokenSource for reconnectTask.
readonly IJobManager jobManager
The IJobManager for the Provider.
async ValueTask< Dictionary< ChatChannel, IEnumerable< ChannelRepresentation > > > MapChannels(IEnumerable< ChatChannel > channels, CancellationToken cancellationToken)
Get the ChannelRepresentations for given channels .A ValueTask<TResult> resulting in a Dictionary<TKe...
ILogger< Provider > Logger
The ILogger for the Provider.
readonly object reconnectTaskLock
Used for synchronizing access to reconnectCts and reconnectTask.
Task SetReconnectInterval(uint reconnectInterval, bool connectNow)
Set the interval at which the provider starts jobs to try to reconnect.A Task representing the runnin...
async Task ReconnectionLoop(uint reconnectInterval, bool connectNow, CancellationToken cancellationToken)
Creates a Task that will attempt to reconnect the Provider every reconnectInterval minutes.
string BotMention
The string that indicates the IProvider was mentioned.
Task? reconnectTask
The auto reconnect Task.
ValueTask< Func< string?, string, ValueTask< Func< bool, ValueTask > > > > SendUpdateMessage(RevisionInformation revisionInformation, Api.Models.EngineVersion engineVersion, DateTimeOffset? estimatedCompletionTime, string? gitHubOwner, string? gitHubRepo, ulong channelId, bool localCommitPushed, CancellationToken cancellationToken)
Send the message for a deployment.A ValueTask<TResult> resulting in a Func<T1, T2,...
void InitialMappingComplete()
Indicate to the provider that at least one MapChannels(IEnumerable<ChatChannel>, CancellationToken) c...
ValueTask SendMessage(Message? replyTo, MessageContent message, ulong channelId, CancellationToken cancellationToken)
Send a message to the IProvider.A ValueTask representing the running operation.
virtual async ValueTask DisposeAsync()
Represents a message to send to a chat provider.
Instance? Instance
The parent Models.Instance.
static Job Create(JobCode code, User? startedBy, Api.Models.Instance instance)
Creates a new job for registering in the Jobs.IJobService.
async ValueTask Delay(TimeSpan timeSpan, CancellationToken cancellationToken)
Create a Task that completes after a given timeSpan .A ValueTask representing the running operation.
For interacting with a chat service.
Manages the runtime of Jobs.
ValueTask< bool?> WaitForJobCompletion(Job job, User? canceller, CancellationToken jobCancellationToken, CancellationToken cancellationToken)
Wait for a given job to complete.
ValueTask RegisterOperation(Job job, JobEntrypoint operation, CancellationToken cancellationToken)
Registers a given Job and begins running it.
For waiting asynchronously.
ChatBotRights
Rights for chat bots.
@ List
User may list files if the Models.Instance allows it.