| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package storage | 5 package storage |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 MaxLogAge time.Duration | 36 MaxLogAge time.Duration |
| 37 } | 37 } |
| 38 | 38 |
| 39 // PutRequest describes adding a single storage record to BigTable. | 39 // PutRequest describes adding a single storage record to BigTable. |
| 40 type PutRequest struct { | 40 type PutRequest struct { |
| 41 // Path is the stream path to retrieve. | 41 // Path is the stream path to retrieve. |
| 42 Path types.StreamPath | 42 Path types.StreamPath |
| 43 // Index is the entry's stream index. | 43 // Index is the entry's stream index. |
| 44 Index types.MessageIndex | 44 Index types.MessageIndex |
| 45 | 45 |
| 46 » // Value is the contents of the cell to add. | 46 » // Values are contiguous sequential records to add to the storage. The f
irst |
| 47 » Value []byte | 47 » // index in values corresponds to Index. |
| 48 » Values [][]byte |
| 48 } | 49 } |
| 49 | 50 |
| 50 // GetRequest is a request to retrieve a series of LogEntry records. | 51 // GetRequest is a request to retrieve a series of LogEntry records. |
| 51 type GetRequest struct { | 52 type GetRequest struct { |
| 52 // Path is the stream path to retrieve. | 53 // Path is the stream path to retrieve. |
| 53 Path types.StreamPath | 54 Path types.StreamPath |
| 54 // Index is the entry's stream index. | 55 // Index is the entry's stream index. |
| 55 Index types.MessageIndex | 56 Index types.MessageIndex |
| 56 | 57 |
| 57 // Limit is the maximum number of records to return before stopping iter
ation. | 58 // Limit is the maximum number of records to return before stopping iter
ation. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 74 // | 75 // |
| 75 // All methods may return errors.Transient errors if they encounter an error | 76 // All methods may return errors.Transient errors if they encounter an error |
| 76 // that may be transient. | 77 // that may be transient. |
| 77 type Storage interface { | 78 type Storage interface { |
| 78 // Close shuts down this instance, releasing any allocated resources. | 79 // Close shuts down this instance, releasing any allocated resources. |
| 79 Close() | 80 Close() |
| 80 | 81 |
| 81 // Writes log record data to storage. | 82 // Writes log record data to storage. |
| 82 // | 83 // |
| 83 // If the data already exists, ErrExists will be returned. | 84 // If the data already exists, ErrExists will be returned. |
| 84 » Put(*PutRequest) error | 85 » Put(PutRequest) error |
| 85 | 86 |
| 86 // Get invokes a callback over a range of sequential LogEntry records. | 87 // Get invokes a callback over a range of sequential LogEntry records. |
| 87 // | 88 // |
| 88 // These log entries will be returned in order (e.g., seq(Rn) < seq(Rn+1
)), | 89 // These log entries will be returned in order (e.g., seq(Rn) < seq(Rn+1
)), |
| 89 // but, depending on ingest, may not be contiguous. | 90 // but, depending on ingest, may not be contiguous. |
| 90 // | 91 // |
| 91 // The underlying Storage implementation may return fewer records than | 92 // The underlying Storage implementation may return fewer records than |
| 92 // requested based on availability or implementation details; consequent
ly, | 93 // requested based on availability or implementation details; consequent
ly, |
| 93 // receiving fewer than requsted records does not necessarily mean that
more | 94 // receiving fewer than requsted records does not necessarily mean that
more |
| 94 // records are not available. | 95 // records are not available. |
| 95 // | 96 // |
| 96 // Returns nil if retrieval executed successfully, ErrDoesNotExist if | 97 // Returns nil if retrieval executed successfully, ErrDoesNotExist if |
| 97 // the requested stream does not exist, and an error if an error occurre
d | 98 // the requested stream does not exist, and an error if an error occurre
d |
| 98 // during retrieval. | 99 // during retrieval. |
| 99 » Get(*GetRequest, GetCallback) error | 100 » Get(GetRequest, GetCallback) error |
| 100 | 101 |
| 101 // Tail retrieves the latest log in the stream. If the stream has no log
s, it | 102 // Tail retrieves the latest log in the stream. If the stream has no log
s, it |
| 102 // will return ErrDoesNotExist. | 103 // will return ErrDoesNotExist. |
| 103 Tail(types.StreamPath) ([]byte, types.MessageIndex, error) | 104 Tail(types.StreamPath) ([]byte, types.MessageIndex, error) |
| 104 | 105 |
| 105 // Config installs the supplied configuration parameters into the storag
e | 106 // Config installs the supplied configuration parameters into the storag
e |
| 106 // instance. | 107 // instance. |
| 107 Config(Config) error | 108 Config(Config) error |
| 108 } | 109 } |
| OLD | NEW |