(ctx context.Context, in *proto.CompletedJob)
| 603 | } |
| 604 | |
| 605 | func (p *Server) CompleteJob(ctx context.Context, in *proto.CompletedJob) error { |
| 606 | // If the moduleFiles exceed the max message size, we need to upload them separately. |
| 607 | if ti, ok := in.Type.(*proto.CompletedJob_TemplateImport_); ok { |
| 608 | messageSize := protobuf.Size(in) |
| 609 | if messageSize > drpcsdk.MaxMessageSize && |
| 610 | messageSize-len(ti.TemplateImport.ModuleFiles) < drpcsdk.MaxMessageSize { |
| 611 | // Hashing the module files to reference them in the CompletedJob message. |
| 612 | moduleFilesHash := sha256.Sum256(ti.TemplateImport.ModuleFiles) |
| 613 | |
| 614 | moduleFiles := ti.TemplateImport.ModuleFiles |
| 615 | ti.TemplateImport.ModuleFiles = []byte{} // Clear the files in the final message |
| 616 | ti.TemplateImport.ModuleFilesHash = moduleFilesHash[:] |
| 617 | err := p.UploadModuleFiles(ctx, moduleFiles) |
| 618 | if err != nil { |
| 619 | return err |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | _, err := clientDoWithRetries(ctx, p.client, func(ctx context.Context, client proto.DRPCProvisionerDaemonClient) (*proto.Empty, error) { |
| 625 | return client.CompleteJob(ctx, in) |
| 626 | }) |
| 627 | return err |
| 628 | } |
| 629 | |
| 630 | // isClosed returns whether the API is closed or not. |
| 631 | func (p *Server) isClosed() bool { |
nothing calls this directly
no test coverage detected