(ctx context.Context, ds database.IDataSource)
| 425 | } |
| 426 | |
| 427 | func dbHasData(ctx context.Context, ds database.IDataSource) bool { |
| 428 | ledgers, err := ds.GetAllLedgers(2, 0) |
| 429 | if err != nil { |
| 430 | logrus.WithError(err).Debug("could not check ledgers for reindex") |
| 431 | return false |
| 432 | } |
| 433 | if len(ledgers) > 1 { |
| 434 | return true |
| 435 | } |
| 436 | |
| 437 | txns, err := ds.GetAllTransactions(ctx, 1, 0) |
| 438 | if err != nil { |
| 439 | logrus.WithError(err).Debug("could not check transactions for reindex") |
| 440 | return false |
| 441 | } |
| 442 | if len(txns) > 0 { |
| 443 | return true |
| 444 | } |
| 445 | |
| 446 | balances, err := ds.GetAllBalances(1, 0) |
| 447 | if err != nil { |
| 448 | logrus.WithError(err).Debug("could not check balances for reindex") |
| 449 | return false |
| 450 | } |
| 451 | if len(balances) > 0 { |
| 452 | return true |
| 453 | } |
| 454 | |
| 455 | identities, err := ds.GetAllIdentitiesPaginated(1, 0) |
| 456 | if err != nil { |
| 457 | logrus.WithError(err).Debug("could not check identities for reindex") |
| 458 | return false |
| 459 | } |
| 460 | return len(identities) > 0 |
| 461 | } |
| 462 | |
| 463 | func typesenseHasData(ctx context.Context, client *TypesenseClient) bool { |
| 464 | resp, err := client.Client.Collection(CollectionTransactions).Retrieve(ctx) |
no test coverage detected