package blob import ( "context" "encoding/gob" "time" "forge.cadoles.com/arcad/edge/pkg/storage" "github.com/pkg/errors" ) func init() { gob.Register(&BlobInfo{}) } type GetBlobInfoArgs struct { 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{ Bucket_: blobInfo.Bucket(), ContentType_: blobInfo.ContentType(), BlobID_: blobInfo.ID(), ModTime_: blobInfo.ModTime(), Size_: blobInfo.Size(), }, } return nil } type BlobInfo struct { Bucket_ string ContentType_ string BlobID_ storage.BlobID ModTime_ time.Time Size_ int64 } // Bucket implements storage.BlobInfo. func (bi *BlobInfo) Bucket() string { return bi.Bucket_ } // ContentType implements storage.BlobInfo. func (bi *BlobInfo) ContentType() string { return bi.ContentType_ } // ID implements storage.BlobInfo. func (bi *BlobInfo) ID() storage.BlobID { return bi.BlobID_ } // ModTime implements storage.BlobInfo. func (bi *BlobInfo) ModTime() time.Time { return bi.ModTime_ } // Size implements storage.BlobInfo. func (bi *BlobInfo) Size() int64 { return bi.Size_ } var _ storage.BlobInfo = &BlobInfo{}