Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 8d1ee7a

Browse files
authored
Nonblocking PublishRevisions (#1149)
* Add block parameter to PublishRevisionsRequest * Nonblocking path
1 parent 58f0cc1 commit 8d1ee7a

File tree

4 files changed

+69
-43
lines changed

4 files changed

+69
-43
lines changed

core/integration/client_tests.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ func (env *Env) setupHistory(ctx context.Context, directory *pb.Directory, userI
373373
DirectoryId: directory.DirectoryId,
374374
MinBatch: 1,
375375
MaxBatch: 1,
376+
Block: true,
376377
}); err != nil {
377378
return fmt.Errorf("sequencer.RunBatch(%v): %v", i, err)
378379
}

core/sequencer/sequencer_api.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ message RunBatchRequest {
5656
int32 min_batch = 2;
5757
// max_batch is the maximum number of items in a batch.
5858
int32 max_batch = 3;
59+
// block until a Signed Log Root has been published which encompases all map roots.
60+
bool block = 4;
5961
}
6062

6163
// DefineRevisionRequest contains information needed to define a new revision.
@@ -99,6 +101,8 @@ message ApplyRevisionResponse {
99101
// PublishRevisionsRequest copies all available SignedMapRoots into the Log of SignedMapRoots.
100102
message PublishRevisionsRequest {
101103
string directory_id = 1;
104+
// block until a Signed Log Root has been published which encompases all map roots.
105+
bool block = 2;
102106
}
103107

104108
// PublishRevisionsResponse contains metrics about the publishing operation.

core/sequencer/sequencer_go_proto/sequencer_api.pb.go

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

core/sequencer/server.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (s *Server) RunBatch(ctx context.Context, in *spb.RunBatchRequest) (*empty.
166166
}
167167
}
168168

169-
publishReq := &spb.PublishRevisionsRequest{DirectoryId: in.DirectoryId}
169+
publishReq := &spb.PublishRevisionsRequest{DirectoryId: in.DirectoryId, Block: in.Block}
170170
_, err = s.loopback.PublishRevisions(ctx, publishReq)
171171
if err != nil {
172172
return nil, err
@@ -377,9 +377,10 @@ func (s *Server) PublishRevisions(ctx context.Context,
377377
return nil, err
378378
}
379379

380-
// TODO(gbelvin): Remove wait when batching boundaries are deterministic.
381-
if err := logClient.WaitForInclusion(ctx, latestRawMapRoot.GetMapRoot()); err != nil {
382-
return nil, status.Errorf(codes.Internal, "WaitForInclusion(): %v", err)
380+
if in.Block {
381+
if err := logClient.WaitForInclusion(ctx, latestRawMapRoot.GetMapRoot()); err != nil {
382+
return nil, status.Errorf(codes.Internal, "WaitForInclusion(): %v", err)
383+
}
383384
}
384385
return &spb.PublishRevisionsResponse{Revisions: revs}, nil
385386
}

0 commit comments

Comments
 (0)