feat: add s3 blob handler(by readll all :( )
This commit is contained in:
@ -53,3 +53,9 @@ var ErrDigestInvalid = &RepositoryError{
|
||||
Code: "NAME_INVALID",
|
||||
Message: "invalid digest",
|
||||
}
|
||||
|
||||
var ErrUnauthorized = &RepositoryError{
|
||||
Status: http.StatusUnauthorized,
|
||||
Code: "UNAUTHORIZED",
|
||||
Message: "access to the requested resource is not authorized",
|
||||
}
|
||||
|
@ -20,3 +20,19 @@ func Timeout(seconds ...int) (ctx context.Context) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func TimeoutCtx(ctx context.Context, seconds ...int) context.Context {
|
||||
var (
|
||||
duration time.Duration
|
||||
)
|
||||
|
||||
if len(seconds) > 0 && seconds[0] > 0 {
|
||||
duration = time.Duration(seconds[0]) * time.Second
|
||||
} else {
|
||||
duration = time.Duration(30) * time.Second
|
||||
}
|
||||
|
||||
nctx, _ := context.WithTimeout(ctx, duration)
|
||||
|
||||
return nctx
|
||||
}
|
||||
|
Reference in New Issue
Block a user