getOperationKeyVal() returns the operation, key, val for a given logical entry position in the segment.
(pos int)
| 519 | // getOperationKeyVal() returns the operation, key, val for a given |
| 520 | // logical entry position in the segment. |
| 521 | func (a *segment) getOperationKeyVal(pos int) (uint64, []byte, []byte) { |
| 522 | x := pos * 2 |
| 523 | if x < len(a.kvs) { |
| 524 | opklvl := a.kvs[x] |
| 525 | kstart := int(a.kvs[x+1]) |
| 526 | operation, keyLen, valLen := decodeOpKeyLenValLen(opklvl) |
| 527 | vstart := kstart + keyLen |
| 528 | |
| 529 | return operation, a.buf[kstart:vstart], a.buf[vstart : vstart+valLen] |
| 530 | } |
| 531 | |
| 532 | return 0, nil, nil |
| 533 | } |
| 534 | |
| 535 | // ------------------------------------------------------ |
| 536 |