ExactLen would calculate the total number of UIDs. Instead of using a UidPack, it accepts blocks, so we can calculate the number of uids after a seek.
(pack *pb.UidPack)
| 425 | // ExactLen would calculate the total number of UIDs. Instead of using a UidPack, it accepts blocks, |
| 426 | // so we can calculate the number of uids after a seek. |
| 427 | func ExactLen(pack *pb.UidPack) int { |
| 428 | if pack == nil { |
| 429 | return 0 |
| 430 | } |
| 431 | sz := len(pack.Blocks) |
| 432 | if sz == 0 { |
| 433 | return 0 |
| 434 | } |
| 435 | num := 0 |
| 436 | for _, b := range pack.Blocks { |
| 437 | num += int(b.NumUids) // NumUids includes the base UID. |
| 438 | } |
| 439 | return num |
| 440 | } |
| 441 | |
| 442 | // Decode decodes the UidPack back into the list of uids. This is a stop-gap function, Decode would |
| 443 | // need to do more specific things than just return the list back. |
no outgoing calls