mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
74 lines
1.8 KiB
Go
74 lines
1.8 KiB
Go
package tdbg
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
"go.temporal.io/server/api/adminservice/v1"
|
|
)
|
|
|
|
type (
|
|
DLQJobService struct {
|
|
clientFactory ClientFactory
|
|
writer io.Writer
|
|
}
|
|
)
|
|
|
|
func NewDLQJobService(
|
|
clientFactory ClientFactory,
|
|
writer io.Writer,
|
|
) *DLQV2Service {
|
|
return &DLQV2Service{
|
|
clientFactory: clientFactory,
|
|
writer: writer,
|
|
}
|
|
}
|
|
|
|
func (ac *DLQJobService) DescribeJob(c *cli.Context) error {
|
|
adminClient := ac.clientFactory.AdminClient(c)
|
|
jobToken := c.String(FlagJobToken)
|
|
jobTokenBytes, err := base64.StdEncoding.DecodeString(jobToken)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to parse job token: %w", err)
|
|
}
|
|
ctx, cancel := newContext(c)
|
|
defer cancel()
|
|
response, err := adminClient.DescribeDLQJob(ctx, &adminservice.DescribeDLQJobRequest{
|
|
JobToken: jobTokenBytes,
|
|
})
|
|
if err != nil {
|
|
return fmt.Errorf("call to DescribeDLQJob failed: %w", err)
|
|
}
|
|
err = newEncoder(ac.writer).Encode(response)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to encode DescribeDLQJob response: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (ac *DLQJobService) CancelJob(c *cli.Context) error {
|
|
adminClient := ac.clientFactory.AdminClient(c)
|
|
jobToken := c.String(FlagJobToken)
|
|
jobTokenBytes, err := base64.StdEncoding.DecodeString(jobToken)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to parse job token: %w", err)
|
|
}
|
|
reason := c.String(FlagReason)
|
|
ctx, cancel := newContext(c)
|
|
defer cancel()
|
|
response, err := adminClient.CancelDLQJob(ctx, &adminservice.CancelDLQJobRequest{
|
|
JobToken: jobTokenBytes,
|
|
Reason: reason,
|
|
})
|
|
if err != nil {
|
|
return fmt.Errorf("call to CancelDLQJob failed: %w", err)
|
|
}
|
|
err = newEncoder(ac.writer).Encode(response)
|
|
if err != nil {
|
|
return fmt.Errorf("unable to encode CancelDLQJob response: %w", err)
|
|
}
|
|
return nil
|
|
}
|