| 408 | } |
| 409 | |
| 410 | func (b *Bucket) recursivelyInspect(name []byte) BucketStructure { |
| 411 | bs := BucketStructure{Name: string(name)} |
| 412 | |
| 413 | keyN := 0 |
| 414 | c := b.Cursor() |
| 415 | for k, _, flags := c.first(); k != nil; k, _, flags = c.next() { |
| 416 | if flags&common.BucketLeafFlag != 0 { |
| 417 | childBucket := b.Bucket(k) |
| 418 | childBS := childBucket.recursivelyInspect(k) |
| 419 | bs.Children = append(bs.Children, childBS) |
| 420 | } else { |
| 421 | keyN++ |
| 422 | } |
| 423 | } |
| 424 | bs.KeyN = keyN |
| 425 | |
| 426 | return bs |
| 427 | } |
| 428 | |
| 429 | // Get retrieves the value for a key in the bucket. |
| 430 | // Returns a nil value if the key does not exist or if the key is a nested bucket. |