| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use)) of this source code is governed under the Apache License, Version 2.0 | 3 Use)) of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 ///<reference path="../logdog-stream/logdog.ts" /> | 7 ///<reference path="../logdog-stream/logdog.ts" /> |
| 8 ///<reference path="../logdog-stream/client.ts" /> | 8 ///<reference path="../logdog-stream/client.ts" /> |
| 9 ///<reference path="../luci-operation/operation.ts" /> | 9 ///<reference path="../luci-operation/operation.ts" /> |
| 10 | 10 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 | 341 |
| 342 if (this.debug) { | 342 if (this.debug) { |
| 343 console.log('logdog.Logs.Get:', request); | 343 console.log('logdog.Logs.Get:', request); |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Perform our Get, waiting until the stream actually exists. | 346 // Perform our Get, waiting until the stream actually exists. |
| 347 let missingRetry = new luci.RetryIterator(Fetcher.missingRetry); | 347 let missingRetry = new luci.RetryIterator(Fetcher.missingRetry); |
| 348 let resp = await missingRetry.do(() => { | 348 let resp = await missingRetry.do(() => { |
| 349 ctx.updateStatus(FetchStatus.LOADING); | 349 ctx.updateStatus(FetchStatus.LOADING); |
| 350 return this.client.get(request); | 350 return this.client.get(ctx.op, request); |
| 351 }, this.doRetryIfMissing(ctx)); | 351 }, this.doRetryIfMissing(ctx)); |
| 352 let fr = FetchResult.make(resp, this.lastDesc); | 352 let fr = FetchResult.make(resp, this.lastDesc); |
| 353 return this.afterProcessResult(ctx, fr); | 353 return this.afterProcessResult(ctx, fr); |
| 354 } | 354 } |
| 355 | 355 |
| 356 private async doTail(ctx: FetchContext) { | 356 private async doTail(ctx: FetchContext) { |
| 357 let missingRetry = new luci.RetryIterator(Fetcher.missingRetry); | 357 let missingRetry = new luci.RetryIterator(Fetcher.missingRetry); |
| 358 let resp = await missingRetry.do(() => { | 358 let resp = await missingRetry.do(() => { |
| 359 ctx.updateStatus(FetchStatus.LOADING); | 359 ctx.updateStatus(FetchStatus.LOADING); |
| 360 let needsState = (this.terminalIndex < 0); | 360 let needsState = (this.terminalIndex < 0); |
| 361 return this.client.tail(this.stream, needsState); | 361 return this.client.tail(ctx.op, this.stream, needsState); |
| 362 }, this.doRetryIfMissing(ctx)); | 362 }, this.doRetryIfMissing(ctx)); |
| 363 | 363 |
| 364 let fr = FetchResult.make(resp, this.lastDesc); | 364 let fr = FetchResult.make(resp, this.lastDesc); |
| 365 return this.afterProcessResult(ctx, fr); | 365 return this.afterProcessResult(ctx, fr); |
| 366 } | 366 } |
| 367 | 367 |
| 368 private afterProcessResult(ctx: FetchContext, fr: FetchResult): | 368 private afterProcessResult(ctx: FetchContext, fr: FetchResult): |
| 369 LogDog.LogEntry[] { | 369 LogDog.LogEntry[] { |
| 370 if (this.debug) { | 370 if (this.debug) { |
| 371 if (fr.logs.length) { | 371 if (fr.logs.length) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 let loadState: LogDog.LogStreamState|undefined; | 430 let loadState: LogDog.LogStreamState|undefined; |
| 431 if (resp.state) { | 431 if (resp.state) { |
| 432 loadState = LogDog.LogStreamState.make(resp.state); | 432 loadState = LogDog.LogStreamState.make(resp.state); |
| 433 } | 433 } |
| 434 | 434 |
| 435 let logs = (resp.logs || []).map(le => LogDog.LogEntry.make(le, desc)); | 435 let logs = (resp.logs || []).map(le => LogDog.LogEntry.make(le, desc)); |
| 436 return new FetchResult(logs, loadDesc, loadState); | 436 return new FetchResult(logs, loadDesc, loadState); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 } | 439 } |
| OLD | NEW |