Skip to content

Commit 749b53d

Browse files
authored
Merge pull request #44 from qubic/40-computors-list
Implement computors list endpoint for v1 query service.
2 parents 15e5239 + 54b5841 commit 749b53d

File tree

18 files changed

+1392
-609
lines changed

18 files changed

+1392
-609
lines changed

v1/app/archive-query-service/main.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ package main
33
import (
44
"errors"
55
"fmt"
6+
"log"
7+
"net/http"
8+
"os"
9+
"os/signal"
10+
"syscall"
11+
"time"
12+
613
"github.com/ardanlabs/conf"
714
"github.com/elastic/go-elasticsearch/v8"
815
grpcProm "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus"
@@ -12,12 +19,6 @@ import (
1219
statusPb "github.com/qubic/go-data-publisher/status-service/protobuf"
1320
"google.golang.org/grpc"
1421
"google.golang.org/grpc/credentials/insecure"
15-
"log"
16-
"net/http"
17-
"os"
18-
"os/signal"
19-
"syscall"
20-
"time"
2122
)
2223

2324
const prefix = "QUBIC_LTS_QUERY_SERVICE"
@@ -50,6 +51,7 @@ func run() error {
5051
ConsecutiveRequestErrorCountThreshold int `conf:"default:10"`
5152
TransactionsIndex string `conf:"default:qubic-transactions-alias"`
5253
TickDataIndex string `conf:"default:qubic-tick-data-alias"`
54+
ComputorListIndex string `conf:"default:qubic-computors-alias"`
5355
}
5456
Metrics struct {
5557
Namespace string `conf:"default:qubic-query"`
@@ -123,7 +125,7 @@ func run() error {
123125
go cache.Start()
124126
defer cache.Stop()
125127

126-
queryBuilder := rpc.NewQueryBuilder(cfg.ElasticSearch.TransactionsIndex, cfg.ElasticSearch.TickDataIndex, esClient, cache)
128+
queryBuilder := rpc.NewQueryBuilder(cfg.ElasticSearch.TransactionsIndex, cfg.ElasticSearch.TickDataIndex, cfg.ElasticSearch.ComputorListIndex, esClient, cache)
127129
rpcServer := rpc.NewServer(cfg.Server.GrpcHost, cfg.Server.HttpHost, queryBuilder, statusServiceClient)
128130
tickInBoundsInterceptor := rpc.NewTickWithinBoundsInterceptor(statusServiceClient, cache)
129131
var identitiesValidatorInterceptor rpc.IdentitiesValidatorInterceptor

v1/protobuf/transactions.pb.go

Lines changed: 847 additions & 370 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v1/protobuf/transactions.pb.gw.go

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v1/protobuf/transactions.proto

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,21 @@ message SkippedTicksInterval {
195195
message SkippedTicksIntervalList {
196196
repeated SkippedTicksInterval skipped_ticks = 1;
197197
}
198+
199+
message Computors {
200+
uint32 epoch = 1;
201+
repeated string identities = 2;
202+
string signature_hex = 3;
203+
}
204+
205+
message GetComputorsRequest {
206+
uint32 epoch = 1;
207+
}
208+
209+
message GetComputorsResponse {
210+
Computors computors = 1;
211+
}
212+
198213
// end of archiver compatible status response
199214

200215
service TransactionsService {
@@ -260,5 +275,11 @@ service TransactionsService {
260275
};
261276
};
262277

278+
rpc GetComputorsList(GetComputorsRequest) returns (GetComputorsResponse) {
279+
option (google.api.http) = {
280+
get: "/v1/epochs/{epoch}/computors"
281+
};
282+
};
283+
263284
}
264285

0 commit comments

Comments
 (0)