Skip to content

Commit

Permalink
action is null for standalone transfer agents.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-graves committed Apr 24, 2023
1 parent 330cad1 commit 224103a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 0 additions & 9 deletions api/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io"
"time"
)

// Header struct
Expand All @@ -13,13 +12,6 @@ type Header struct {
Value string `json:"value"`
}

// Action struct
type Action struct {
Href string `json:"href"`
Header map[string]string `json:"header,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
}

// Error struct
type Message struct {
Event string `json:"event"`
Expand All @@ -44,7 +36,6 @@ type Request struct {
Oid string `json:"oid"`
Size int64 `json:"size"`
Path string `json:"path"`
Action *Action `json:"action"`
}

// InitResponse with response for init
Expand Down
8 changes: 4 additions & 4 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ func Serve(stdin io.Reader, stdout, stderr io.Writer) {
api.SendResponse(resp, writer, stderr)
case "download":
fmt.Fprintf(stderr, fmt.Sprintf("Received download request for %s\n", req.Oid))
retrieve(req.Oid, req.Size, req.Action, writer, stderr)
retrieve(req.Oid, req.Size, writer, stderr)
case "upload":
fmt.Fprintf(stderr, fmt.Sprintf("Received upload request for %s\n", req.Oid))
store(req.Oid, req.Size, req.Action, writer, stderr)
store(req.Oid, req.Size, writer, stderr)
case "terminate":
fmt.Fprintf(stderr, "Terminating test custom adapter gracefully.\n")
break
Expand Down Expand Up @@ -103,7 +103,7 @@ func createS3Client() *s3.Client {
return s3.NewFromConfig(cfg)
}

func retrieve(oid string, size int64, action *api.Action, writer io.Writer, stderr io.Writer) {
func retrieve(oid string, size int64, writer io.Writer, stderr io.Writer) {
client := createS3Client()
bucketName := os.Getenv("S3_BUCKET")

Expand Down Expand Up @@ -149,7 +149,7 @@ func retrieve(oid string, size int64, action *api.Action, writer io.Writer, stde
}
}

func store(oid string, size int64, action *api.Action, writer io.Writer, stderr io.Writer) {
func store(oid string, size int64, writer io.Writer, stderr io.Writer) {
client := createS3Client()
bucketName := os.Getenv("S3_BUCKET")

Expand Down

0 comments on commit 224103a

Please sign in to comment.