MCPcopy Create free account
hub / github.com/couchbase/moss / mutateEx

Method mutateEx

segment.go:256–287  ·  view source on GitHub ↗
(operation uint64,
	keyStart, keyLength, valLength int)

Source from the content-addressed store, hash-verified

254}
255
256func (a *segment) mutateEx(operation uint64,
257 keyStart, keyLength, valLength int) error {
258 if keyLength > maxKeyLength {
259 return ErrKeyTooLarge
260 }
261 if valLength > maxValLength {
262 return ErrValueTooLarge
263 }
264
265 if keyLength <= 0 && valLength <= 0 {
266 keyStart = 0
267 }
268
269 opKlVl := encodeOpKeyLenValLen(operation, keyLength, valLength)
270
271 a.kvs = append(a.kvs, opKlVl, uint64(keyStart))
272
273 switch operation {
274 case OperationSet:
275 a.totOperationSet++
276 case OperationDel:
277 a.totOperationDel++
278 case OperationMerge:
279 a.totOperationMerge++
280 default:
281 }
282
283 a.totKeyByte += uint64(keyLength)
284 a.totValByte += uint64(valLength)
285
286 return nil
287}
288
289// ------------------------------------------------------
290

Callers 5

AllocSetMethod · 0.95
AllocDelMethod · 0.95
AllocMergeMethod · 0.95
mutateMethod · 0.95

Calls 1

encodeOpKeyLenValLenFunction · 0.85

Tested by 1