Function
encodeInsertOperation
(ibuf, buf *bytes.Buffer)
Source from the content-addressed store, hash-verified
| 136 | } |
| 137 | |
| 138 | func encodeInsertOperation(ibuf, buf *bytes.Buffer) { |
| 139 | if ibuf.Len() == 0 { |
| 140 | return |
| 141 | } |
| 142 | |
| 143 | b := ibuf.Bytes() |
| 144 | s := ibuf.Len() |
| 145 | o := 0 |
| 146 | for { |
| 147 | if s <= 127 { |
| 148 | break |
| 149 | } |
| 150 | buf.WriteByte(byte(127)) |
| 151 | buf.Write(b[o : o+127]) |
| 152 | s -= 127 |
| 153 | o += 127 |
| 154 | } |
| 155 | buf.WriteByte(byte(s)) |
| 156 | buf.Write(b[o : o+s]) |
| 157 | |
| 158 | ibuf.Reset() |
| 159 | } |
| 160 | |
| 161 | func deltaEncodeSize(size int) []byte { |
| 162 | var ret []byte |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…