ЛР4 - БВТ2303 - Голиков- на 4 #13

Closed
Maximillan_Mercer wants to merge 64 commits from Maximillan_Mercer/mtusi2026lab4-fork:solution/BVT2303-Golikov into main
2 changed files with 6 additions and 0 deletions
Showing only changes of commit 4d28ae549a - Show all commits
+1
View File
@@ -13,6 +13,7 @@ type ObjectInfo struct {
} }
type ObjectStorage interface { type ObjectStorage interface {
Ping(ctx context.Context) error
Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error
Get(ctx context.Context, key string) (io.ReadCloser, int64, string, error) Get(ctx context.Context, key string) (io.ReadCloser, int64, string, error)
Delete(ctx context.Context, key string) error Delete(ctx context.Context, key string) error
+5
View File
@@ -45,6 +45,11 @@ func New(ctx context.Context, cfg Config) (*MinioStorage, error) {
return &MinioStorage{client: client, bucket: cfg.Bucket}, nil return &MinioStorage{client: client, bucket: cfg.Bucket}, nil
} }
func (s *MinioStorage) Ping(ctx context.Context) error {
_, err := s.client.BucketExists(ctx, s.bucket)
return mapError(err)
}
func (s *MinioStorage) Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error { func (s *MinioStorage) Put(ctx context.Context, key string, r io.Reader, size int64, contentType string) error {
_, err := s.client.PutObject(ctx, s.bucket, key, r, size, minio.PutObjectOptions{ _, err := s.client.PutObject(ctx, s.bucket, key, r, size, minio.PutObjectOptions{
ContentType: contentType, ContentType: contentType,