Skip to content

Commit e8a933a

Browse files
committed
search after support
1 parent 79b2062 commit e8a933a

37 files changed

Lines changed: 152 additions & 64 deletions

src/common/entities/query.pagination.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export class QueryPagination {
88

99
before?: number;
1010
after?: number;
11+
searchAfter?: string;
1112
}

src/common/indexer/elastic/circuit-breaker/circuit.breaker.proxy.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ export class EsCircuitBreakerProxy {
6868
}
6969

7070
// eslint-disable-next-line require-await
71-
async getList(index: string, id: string, query: ElasticQuery): Promise<any[]> {
72-
return this.withCircuitBreaker(() => this.elasticService.getList(index, id, query));
71+
async getList(index: string, id: string, query: ElasticQuery, searchAfter?: string): Promise<any[]> {
72+
//TODO: update package
73+
// @ts-ignore
74+
return this.withCircuitBreaker(() => this.elasticService.getList(index, id, query, undefined, searchAfter));
7375
}
7476

7577
// eslint-disable-next-line require-await

src/common/indexer/elastic/elastic.indexer.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class ElasticIndexerService implements IndexerInterface {
136136

137137
query = this.buildTokenFilter(query, filter);
138138

139-
return await this.elasticService.getList('accountsesdt', 'token', query);
139+
return await this.elasticService.getList('accountsesdt', 'token', query, queryPagination.searchAfter);
140140
}
141141

142142
async getTokenAccountsCount(identifier: string): Promise<number | undefined> {
@@ -294,7 +294,7 @@ export class ElasticIndexerService implements IndexerInterface {
294294
.withPagination({ from: pagination.from, size: pagination.size })
295295
.withSort([timestamp, nonce]);
296296

297-
const elasticOperations = await this.elasticService.getList('operations', 'txHash', elasticQuery);
297+
const elasticOperations = await this.elasticService.getList('operations', 'txHash', elasticQuery, pagination.searchAfter);
298298

299299
this.bulkProcessTransactions(elasticOperations);
300300

@@ -559,7 +559,7 @@ export class ElasticIndexerService implements IndexerInterface {
559559
.withPagination({ from: pagination.from, size: pagination.size })
560560
.withSort([timestamp, nonce]);
561561

562-
const transactions = await this.elasticService.getList('operations', 'txHash', elasticQuery);
562+
const transactions = await this.elasticService.getList('operations', 'txHash', elasticQuery, pagination.searchAfter);
563563

564564
this.bulkProcessTransactions(transactions);
565565

src/common/indexer/entities/account.history.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export interface AccountHistory {
1+
import { ElasticSortable } from "./elastic.sortable";
2+
3+
export interface AccountHistory extends ElasticSortable {
24
address: string;
35
timestamp: number;
46
balance: string;

src/common/indexer/entities/account.token.history.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export interface AccountTokenHistory {
1+
import { ElasticSortable } from "./elastic.sortable";
2+
3+
export interface AccountTokenHistory extends ElasticSortable {
24
address: string;
35
timestamp: number;
46
balance: string;

src/common/indexer/entities/account.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export interface Account {
1+
import { ElasticSortable } from "./elastic.sortable";
2+
3+
export interface Account extends ElasticSortable {
24
address: string;
35
nonce: number;
46
timestampMs: number;

src/common/indexer/entities/block.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export interface Block {
1+
import { ElasticSortable } from "./elastic.sortable";
2+
3+
export interface Block extends ElasticSortable {
24
hash: string;
35
nonce: number;
46
round: number;

src/common/indexer/entities/collection.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { ElasticSortable } from "./elastic.sortable";
2+
13
export interface CollectionProperties {
24
canMint?: boolean;
35
canBurn?: boolean;
@@ -11,7 +13,7 @@ export interface CollectionProperties {
1113
canCreateMultiShard?: boolean;
1214
}
1315

14-
export interface Collection {
16+
export interface Collection extends ElasticSortable {
1517
_id: string;
1618
name: string;
1719
ticker: string;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface ElasticSortable {
2+
searchAfter?: string;
3+
}

src/common/indexer/entities/events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export class Events {
2+
searchAfter?: string;
23
_id: string = '';
34
logAddress: string = '';
45
identifier: string = '';

0 commit comments

Comments
 (0)