Skip to content

Commit

Permalink
storj#37 Instrument all non-trivial functions with monkit's Task
Browse files Browse the repository at this point in the history
  • Loading branch information
avinilcode committed Nov 1, 2022
1 parent 1f77cfa commit 33d5d99
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func (a AccessConfig) GetAccess() (_ *uplink.Access, err error) {

// GetNamedAccess returns named access if exists.
func (a AccessConfig) GetNamedAccess(name string) (_ *uplink.Access, err error) {
// if an access exists for that name, try to load it.
defer mon.Task()(nil)(&err)

// if an access exists for that name, try to load it.
if data, ok := a.Accesses[name]; ok {
return uplink.ParseAccess(data)
}
Expand Down
10 changes: 6 additions & 4 deletions internal/minioclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import (
"github.com/zeebo/errs"
)

// MinioError is class for minio errors.
var MinioError = errs.Class("minio error")
var mon = monkit.Package()
var (
// MinioError is class for minio errors.
MinioError = errs.Class("minio error")
mon = monkit.Package()
)

// Config is the setup for a particular client.
type Config struct {
Expand Down Expand Up @@ -129,7 +131,7 @@ func (client *Minio) UploadMultipart(bucket, objectName string, data []byte, par
}

// Download downloads object data.
func (client *Minio) Download(bucket, objectName string, buffer []byte) (buf []byte, err error) {
func (client *Minio) Download(bucket, objectName string, buffer []byte) (_ []byte, err error) {
defer mon.Task()(nil)(&err)

reader, err := client.API.GetObject(bucket, objectName, minio.GetObjectOptions{})
Expand Down

0 comments on commit 33d5d99

Please sign in to comment.