public Task ClearPendingLogState(string channelName) { lock (this) { return(TaskExtension.GetCompletedTask()); } }
public Task WaitOperationsAsync(TimeSpan timeout) { lock (this) { return(TaskExtension.GetCompletedTask()); } }
public Task <int> CountLogsAsync(string channelName) { lock (this) { return(TaskExtension.GetCompletedTask(this[channelName].Count)); } }
public Task <bool> SetMaxStorageSizeAsync(long sizeInBytes) { lock (this) { return(TaskExtension.GetCompletedTask(true)); } }
public Task <bool> ShutdownAsync(TimeSpan timeout) { lock (this) { return(TaskExtension.GetCompletedTask(true)); } }
public Task DeleteLogs(string channelName) { lock (this) { _storage.Remove(channelName); return(TaskExtension.GetCompletedTask()); } }
public Task PutLog(string channelName, Log log) { lock (this) { this[channelName].Add(log); return(TaskExtension.GetCompletedTask()); } }
public Task DeleteLogs(string channelName) { lock (this) { AppCenterLog.Debug(AppCenterLog.LogTag, $"Storage.DeleteLogs for channelName={channelName}"); _storage.Remove(channelName); return(TaskExtension.GetCompletedTask()); } }
public Task PutLog(string channelName, Log log) { lock (this) { AppCenterLog.Debug(AppCenterLog.LogTag, $"Storage.PutLog for channelName={channelName}: {log}"); this[channelName].Add(log); return(TaskExtension.GetCompletedTask()); } }
public Task DeleteLogs(string channelName, string batchId) { lock (this) { var batch = _pending[batchId]; this[channelName].RemoveAll(log => batch.Contains(log)); return(TaskExtension.GetCompletedTask()); } }
public Task DeleteLogs(string channelName, string batchId) { lock (this) { AppCenterLog.Debug(AppCenterLog.LogTag, $"Storage.DeleteLogs for channelName={channelName} and batchId={batchId}"); var batch = _pending[batchId]; this[channelName].RemoveAll(log => batch.Contains(log)); return(TaskExtension.GetCompletedTask()); } }
public Task <string> GetLogsAsync(string channelName, int limit, List <Log> logs) { lock (this) { var batchId = Guid.NewGuid().ToString(); var batch = this[channelName].Take(limit).ToList(); _pending.Add(batchId, batch); logs?.Clear(); logs?.AddRange(batch); return(TaskExtension.GetCompletedTask(batchId)); } }
public Task <string> GetLogsAsync(string channelName, int limit, List <Log> logs) { lock (this) { var pending = _pending.SelectMany(i => i.Value).ToList(); var batchId = Guid.NewGuid().ToString(); var batch = this[channelName] .Where(log => !pending.Contains(log)) .Take(limit).ToList(); _pending.Add(batchId, batch); logs?.Clear(); logs?.AddRange(batch); return(TaskExtension.GetCompletedTask(batchId)); } }
public Task <string> GetLogsAsync(string channelName, int limit, List <Log> logs) { lock (this) { var pending = _pending.SelectMany(i => i.Value).ToList(); var batchId = Guid.NewGuid().ToString(); var batch = this[channelName] .Where(log => !pending.Contains(log)) .Take(limit).ToList(); if (batch.Count == 0) { return(TaskExtension.GetCompletedTask <string>(null)); } _pending.Add(batchId, batch); logs?.Clear(); logs?.AddRange(batch); AppCenterLog.Debug(AppCenterLog.LogTag, $"Storage.GetLogsAsync for channelName={channelName}: batchId={batchId} with logs={string.Join(",", logs)}"); return(TaskExtension.GetCompletedTask(batchId)); } }
/// <summary> /// Helper for setup responce. /// </summary> protected ISetup <IHttpNetworkAdapter, Task <string> > SetupAdapterSendResponse(params HttpStatusCode[] statusCodes) { var index = 0; var setup = _adapter .Setup(a => a.SendAsync( It.IsAny <string>(), "POST", It.IsAny <IDictionary <string, string> >(), It.IsAny <string>(), It.IsAny <CancellationToken>())); setup.Returns(() => { var statusCode = statusCodes[index < statusCodes.Length ? index++ : statusCodes.Length - 1]; return(statusCode == HttpStatusCode.OK ? TaskExtension.GetCompletedTask("") : TaskExtension.GetFaultedTask <string>(new HttpIngestionException("") { StatusCode = (int)statusCode })); }); return(setup); }
public Task ClearPendingLogStateAsync(string channelName) { return(TaskExtension.GetCompletedTask()); }
public Task DeleteLogsAsync(string channelName) { return(TaskExtension.GetCompletedTask()); }
public Task <int> CountLogsAsync(string channelName) { return(TaskExtension.GetCompletedTask(1)); }
public Task DeleteLogs(string channelName, string batchId) { return(TaskExtension.GetCompletedTask()); }
public Task <string> GetLogsAsync(string channelName, int limit, List <Log> logs) { return(TaskExtension.GetCompletedTask(Guid.NewGuid().ToString())); }
public Task PutLog(string channelName, Log log) { return(TaskExtension.GetCompletedTask()); }