validate checks the referential integrity ensures len(keys) == len(containers), recurses and checks each container type
()
| 436 | // validate checks the referential integrity |
| 437 | // ensures len(keys) == len(containers), recurses and checks each container type |
| 438 | func (ra *roaringArray64) validate() error { |
| 439 | if !ra.checkKeysSorted() { |
| 440 | return ErrKeySortOrder |
| 441 | } |
| 442 | |
| 443 | if len(ra.keys) != len(ra.containers) { |
| 444 | return ErrCardinalityConstraint |
| 445 | } |
| 446 | |
| 447 | if len(ra.keys) != len(ra.needCopyOnWrite) { |
| 448 | return ErrCardinalityConstraint |
| 449 | } |
| 450 | |
| 451 | for _, maps := range ra.containers { |
| 452 | err := maps.Validate() |
| 453 | if err != nil { |
| 454 | return err |
| 455 | } |
| 456 | if maps.IsEmpty() { |
| 457 | return errors.New("empty container") |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | return nil |
| 462 | } |