Commit 6b07b01
committed
object_db.go: replace decode with openDecode
In a subsequent commit, we will introduce a function to produce an
implementation of Object the concrete type of which is determined by the
type associated with the object named "SHA".
In order to do so, we would like to be able to call "o.decode()" without
having to open the object referred to above more than once (for example,
once to check the type, and the second time to read the object's
contents).
To make this possible, let's teach decode to accept an `*ObjectReader`
instead of an `sha []byte`, and defer the responsibility of calling
`o.open()` (which roughly translates a `[]byte` into an `*ObjectReader,
error)`), to an external caller.
To make calling `decode()` as easy as it was before this change, we'll
introduce `decodeOpen()`, which first calls `o.open()`, and then passes
on either (1) the resulting error, or (2) the result of calling
`o.decode()` with the newly opened object.1 parent 5aa0c18 commit 6b07b01
1 file changed
+15
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
275 | 285 | | |
276 | 286 | | |
277 | 287 | | |
| |||
280 | 290 | | |
281 | 291 | | |
282 | 292 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 293 | + | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
| |||
0 commit comments