37 lines
637 B
Go
37 lines
637 B
Go
package blob
|
|
|
|
import (
|
|
"context"
|
|
|
|
"forge.cadoles.com/arcad/edge/pkg/storage"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type GetBlobInfoArgs struct {
|
|
Name string
|
|
BlobID storage.BlobID
|
|
BucketID BucketID
|
|
}
|
|
|
|
type GetBlobInfoReply struct {
|
|
BlobInfo storage.BlobInfo
|
|
}
|
|
|
|
func (s *Service) GetBlobInfo(ctx context.Context, args *GetBlobInfoArgs, reply *GetBlobInfoReply) error {
|
|
bucket, err := s.getOpenedBucket(args.BucketID)
|
|
if err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
blobInfo, err := bucket.Get(ctx, args.BlobID)
|
|
if err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
*reply = GetBlobInfoReply{
|
|
BlobInfo: blobInfo,
|
|
}
|
|
|
|
return nil
|
|
}
|