Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Rename RunBatch to ApplyRevisions #1351

Merged
merged 1 commit into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/keytransparency-sequencer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ func runSequencer(ctx context.Context, conn *grpc.ClientConn,
}
})
go sequencer.PeriodicallyRun(ctx, time.Tick(*refresh), func(ctx context.Context) {
if err := signer.RunBatchForAllMasterships(ctx); err != nil {
glog.Errorf("PeriodicallyRun(RunBatchForAllMasterships): %v", err)
if err := signer.ApplyRevisionsForAllMasterships(ctx); err != nil {
glog.Errorf("PeriodicallyRun(ApplyRevisionsForAllMasterships): %v", err)
}
})

Expand Down
6 changes: 3 additions & 3 deletions core/integration/client_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ func runBatchAndPublish(ctx context.Context, env *Env, mn, mx int32, block bool)
if _, err := env.Sequencer.DefineRevisions(ctx, drReq); err != nil {
return convert(err, "DefineRevisions()")
}
rbReq := &spb.RunBatchRequest{DirectoryId: env.Directory.DirectoryId}
if _, err := env.Sequencer.RunBatch(ctx, rbReq); err != nil {
return convert(err, "RunBatch()")
arReq := &spb.ApplyRevisionsRequest{DirectoryId: env.Directory.DirectoryId}
if _, err := env.Sequencer.ApplyRevisions(ctx, arReq); err != nil {
return convert(err, "ApplyRevisions()")
}
prReq := &spb.PublishRevisionsRequest{
DirectoryId: env.Directory.DirectoryId,
Expand Down
15 changes: 8 additions & 7 deletions core/sequencer/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,15 @@ func (s *Sequencer) DefineRevisionsForAllMasterships(ctx context.Context, batchS
})
}

// RunBatchForAllMasterships runs KeyTransparencySequencerClient.RunBatch on
// all directories that this sequencer is currently master for.
func (s *Sequencer) RunBatchForAllMasterships(ctx context.Context) error {
glog.Infof("RunBatchForAllMasterships")
// ApplyRevisionsForAllMasterships runs KeyTransparencySequencerClient's
// ApplyRevisions method on all directories that this sequencer is currently
// master for.
func (s *Sequencer) ApplyRevisionsForAllMasterships(ctx context.Context) error {
glog.Infof("ApplyRevisionsForAllMasterships")
return s.ForAllMasterships(ctx, func(ctx context.Context, dirID string) error {
req := &spb.RunBatchRequest{DirectoryId: dirID}
if _, err := s.sequencerClient.RunBatch(ctx, req); err != nil {
glog.Errorf("RunBatch for %v failed: %v", dirID, err)
req := &spb.ApplyRevisionsRequest{DirectoryId: dirID}
if _, err := s.sequencerClient.ApplyRevisions(ctx, req); err != nil {
glog.Errorf("ApplyRevisions for %v failed: %v", dirID, err)
return err
}
return nil
Expand Down
21 changes: 9 additions & 12 deletions core/sequencer/sequencer_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ message MapMetadata {
repeated SourceSlice sources = 2;
}

// RunBatchRequest triggers the sequencing of a batch of mutations for a
// directory, with the batch size governed by the request parameters.
message RunBatchRequest {
// directory_id is the directory to run for.
string directory_id = 1;
// Deprecated tags, do not reuse.
reserved 2, 3, 4;
}

// DefineRevisionsRequest contains information needed to define new revisions.
message DefineRevisionsRequest {
// directory_id is the directory to examine the outstanding mutations for.
Expand Down Expand Up @@ -94,6 +85,12 @@ message GetDefinedRevisionsResponse {
int64 highest_defined = 2;
}

// ApplyRevisionsRequest triggers applying revisions to the directory's map.
message ApplyRevisionsRequest {
// directory_id is the directory to apply revisions for.
string directory_id = 1;
}

// ApplyRevisionRequest contains information needed to create a new revision.
message ApplyRevisionRequest {
// directory_id is the directory to apply the mutations to.
Expand Down Expand Up @@ -137,14 +134,14 @@ message UpdateMetricsResponse {}

// The KeyTransparency Sequencer API.
service KeyTransparencySequencer {
// RunBatch figures out the outstanding revisions, and applies the
// corresponding mutations the to the map.
rpc RunBatch(RunBatchRequest) returns (google.protobuf.Empty);
// DefineRevisions returns the info on defined/applied revisions, after
// optionally defining a new revision of outstanding mutations.
rpc DefineRevisions(DefineRevisionsRequest) returns (DefineRevisionsResponse);
// GetDefinedRevisions returns the range of defined and unapplied revisions.
rpc GetDefinedRevisions(GetDefinedRevisionsRequest) returns (GetDefinedRevisionsResponse);
// ApplyRevisions figures out the outstanding revisions, and applies the
// corresponding mutations the to the map.
rpc ApplyRevisions(ApplyRevisionsRequest) returns (google.protobuf.Empty);
// ApplyRevision applies the contained mutations to the current map root.
// If this method fails, it must be retried with the same arguments.
rpc ApplyRevision(ApplyRevisionRequest) returns (ApplyRevisionResponse);
Expand Down
Loading