示例#1
0
        private static MinioClient CreateMiniotClient_(S3StorageConfig s3Config)
        {
            var minioClient = new Minio.MinioClient(
                s3Config.Provider.EndPoint,
                s3Config.AccessKey,
                s3Config.SecretKey
                );

            if (s3Config.Proxies.Any())
            {
                var proxyInfo = s3Config.Proxies.First();
                minioClient.WithProxy(proxyInfo.CreateWebProxy());
            }
            clientDict_.Add(s3Config.Provider, minioClient);

            #if RELEASE
            return(minioClient.WithSSL());
            #else
            return(minioClient);
            #endif
        }
示例#2
0
        public static S3ObjectsListingClient GetQueryClient(this S3StorageConfig s3Config)
        {
            return(rwlock_.EnterUpgradableLock(upg =>
            {
                if (clientDict_.TryGetValue(s3Config.Provider, out var minioClient))
                {
                    return new S3ObjectsListingClient(minioClient);
                }
                else
                {
                    return upg.Enter(CreateClient_);
                }
            }));


            S3ObjectsListingClient CreateClient_()
            {
                var minioClient = CreateMiniotClient_(s3Config);

                return(new S3ObjectsListingClient(minioClient));
            }
        }
示例#3
0
        public static IS3UploadClient GetUploadClient(this S3StorageConfig s3Config)
        {
            return(rwlock_.EnterUpgradableLock(upg =>
            {
                if (clientDict_.TryGetValue(s3Config.Provider, out var minioClient))
                {
                    return new MinioS3UploadClient(minioClient);
                }
                else
                {
                    return upg.Enter(CreateClient_);
                }
            }));


            IS3UploadClient CreateClient_()
            {
                var minioClient = CreateMiniotClient_(s3Config);

                return(new MinioS3UploadClient(minioClient));
            }
        }
示例#4
0
 public S3StorageWorker(S3StorageConfig config)
 => this.Config = config;