| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Package backend implements the set of backend handlers used by the LogDog | |
| 6 // Coordiantor. This consists of both cron handlers and work handlers. The | |
| 7 // cron handlers will dispatch task queue tasks that will be serviced by the | |
| 8 // work handlers. | |
| 9 // | |
| 10 // The backend interfaces between the two log storage spaces that LogDog uses: | |
| 11 // - Intermediate storage: Logs are accumulated here from the Transport by
the | |
| 12 // Collector. They reside here until they are either complete or they | |
| 13 // timeout, at which point they are moved (via archival) to the archive | |
| 14 // storage. | |
| 15 // - Archive storage: Logs are moved from intermediate storage to archive | |
| 16 // storage upon completion. An index and associated data is generated for
the | |
| 17 // stream and it is considered finalized and immutable. This should be a | |
| 18 // cheaper storage location, possibly with cold storage capabilities. | |
| 19 // | |
| 20 // Archival | |
| 21 // | |
| 22 // Archival begins with a periodic cron job that scans through LogStream | |
| 23 // datastore entries looking for streams that have not yet been archived. A | |
| 24 // given stream will have archival initiated if: | |
| 25 // - It has been closed for the configured `archive_delay` period. | |
| 26 // - It has not been archived for at least `archive_max_delay`. | |
| 27 // | |
| 28 // In the first case, we scan for logs that have been terminated and dispatch | |
| 29 // archival tasks requesting complete archival. This is the standard case, | |
| 30 // and will identify log streams that have had their terminal indexes | |
| 31 // registered. | |
| 32 // | |
| 33 // The second case is the failsafe case. If a log stream has been inactive for | |
| 34 // sufficiently long enough without actually being terminal, we preempt it and | |
| 35 // assume that something weng wrong in transit, dropping the terminal log entry. | |
| 36 // | |
| 37 // The archive cron job will dispatch an archive request to the archive backend | |
| 38 // handler for each log stream that matches one of these situations. | |
| 39 // | |
| 40 // Each archival task will look at the last time the LogStream has been updated. | |
| 41 // If this does not exceed our `archive_max_delay` (standard case), we will only | |
| 42 // complete archival if every LogEntry between [0..terminalIndex] is | |
| 43 // successfully archived. If we are past `archive_max_delay` (failsafe), we will | |
| 44 // do a best-effort sparse archival with whatever data is available. | |
| 45 package backend | |
| OLD | NEW |