MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / validate

Method validate

roaring64/roaringarray64.go:438–462  ·  view source on GitHub ↗

validate checks the referential integrity ensures len(keys) == len(containers), recurses and checks each container type

()

Source from the content-addressed store, hash-verified

436// validate checks the referential integrity
437// ensures len(keys) == len(containers), recurses and checks each container type
438func (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}

Callers 1

Calls 3

checkKeysSortedMethod · 0.95
ValidateMethod · 0.45
IsEmptyMethod · 0.45

Tested by 1