zeroshade commented on code in PR #709:
URL: https://github.com/apache/iceberg-go/pull/709#discussion_r2771259125
##########
io/gocloud/azure_integration_test.go:
##########
@@ -64,10 +64,10 @@ func (s *AzureBlobIOTestSuite) TestAzureBlobWarehouseKey() {
sqlcat.DriverKey: sqliteshim.ShimName,
sqlcat.DialectKey: string(sqlcat.SQLite),
"type": "sql",
- io.AdlsSharedKeyAccountName: accountName,
- io.AdlsSharedKeyAccountKey: accountKey,
- io.AdlsEndpoint: endpoint,
- io.AdlsProtocol: protocol,
+ gocloud.AdlsSharedKeyAccountName: accountName,
+ gocloud.AdlsSharedKeyAccountKey: accountKey,
+ gocloud.AdlsEndpoint: endpoint,
+ gocloud.AdlsProtocol: protocol,
Review Comment:
same as above
##########
io/gocloud/register.go:
##########
@@ -0,0 +1,85 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package gocloud
+
+import (
+ "context"
+ "net/url"
+
+ icebergio "github.com/apache/iceberg-go/io"
+ "gocloud.dev/blob/memblob"
+)
+
+func init() {
+ registerS3Schemes()
+ registerGCSScheme()
+ registerMemScheme()
+ registerAzureSchemes()
+}
+
+// registerS3Schemes registers S3-compatible storage schemes (s3, s3a, s3n).
+func registerS3Schemes() {
+ s3Factory := func(ctx context.Context, parsed *url.URL, props
map[string]string) (icebergio.IO, error) {
+ bucket, err := createS3Bucket(ctx, parsed, props)
+ if err != nil {
+ return nil, err
+ }
+
+ return createBlobFS(ctx, bucket,
defaultKeyExtractor(parsed.Host)), nil
+ }
+ icebergio.Register("s3", s3Factory)
+ icebergio.Register("s3a", s3Factory)
+ icebergio.Register("s3n", s3Factory)
+}
+
+// registerGCSScheme registers the Google Cloud Storage scheme (gs).
+func registerGCSScheme() {
+ icebergio.Register("gs", func(ctx context.Context, parsed *url.URL,
props map[string]string) (icebergio.IO, error) {
+ bucket, err := createGCSBucket(ctx, parsed, props)
+ if err != nil {
+ return nil, err
+ }
+
+ return createBlobFS(ctx, bucket,
defaultKeyExtractor(parsed.Host)), nil
+ })
+}
+
+// registerMemScheme registers the in-memory blob storage scheme (mem).
+func registerMemScheme() {
+ icebergio.Register("mem", func(ctx context.Context, parsed *url.URL,
props map[string]string) (icebergio.IO, error) {
+ bucket := memblob.OpenBucket(nil)
+
+ return createBlobFS(ctx, bucket,
defaultKeyExtractor(parsed.Host)), nil
+ })
Review Comment:
I don't think we had any tests for mem, can we add some?
##########
catalog/sql/sql_integration_test.go:
##########
@@ -70,9 +71,9 @@ func (s *SQLIntegrationSuite) loadCatalog(ctx
context.Context) *sql.Catalog {
"uri": "file:" + dbPath,
"sql.dialect": "sqlite",
"sql.driver": "sqlite",
- io.S3Region: "us-east-1",
- io.S3AccessKeyID: "admin",
- io.S3SecretAccessKey: "password",
+ gocloud.S3Region: "us-east-1",
+ gocloud.S3AccessKeyID: "admin",
+ gocloud.S3SecretAccessKey: "password",
Review Comment:
same as above
##########
catalog/rest/rest_integration_test.go:
##########
@@ -51,9 +52,9 @@ func (s *RestIntegrationSuite) loadCatalog(ctx
context.Context) *rest.Catalog {
cat, err := catalog.Load(ctx, "local", iceberg.Properties{
"type": "rest",
"uri": "http://localhost:8181",
- io.S3Region: "us-east-1",
- io.S3AccessKeyID: "admin",
- io.S3SecretAccessKey: "password",
+ gocloud.S3Region: "us-east-1",
+ gocloud.S3AccessKeyID: "admin",
+ gocloud.S3SecretAccessKey: "password",
Review Comment:
since these are properties that tend to be shared across any IO
implementation, we should probably leave these constants in the `io` package
rather than moving them down to the `gocloud` package. the assumption being
that the properties being looked for in the catalog should not be dependant on
the IO implementation being used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]