Skip to content

Commit

Permalink
Consolidate Delta Lake synchronizer bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Oct 11, 2023
1 parent 9ed04a9 commit c6d19de
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 76 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,33 @@
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.google.inject.multibindings.MapBinder;
import io.trino.plugin.deltalake.transactionlog.writer.AzureTransactionLogSynchronizer;
import io.trino.plugin.deltalake.transactionlog.writer.GcsTransactionLogSynchronizer;
import io.trino.plugin.deltalake.transactionlog.writer.S3NativeTransactionLogSynchronizer;
import io.trino.plugin.deltalake.transactionlog.writer.TransactionLogSynchronizer;

import static com.google.inject.multibindings.MapBinder.newMapBinder;
import static io.airlift.json.JsonCodecBinder.jsonCodecBinder;

public class DeltaLakeS3Module
public class DeltaLakeSynchronizerModule
implements Module
{
@Override
public void configure(Binder binder)
{
MapBinder<String, TransactionLogSynchronizer> logSynchronizerMapBinder = newMapBinder(binder, String.class, TransactionLogSynchronizer.class);
var synchronizerBinder = newMapBinder(binder, String.class, TransactionLogSynchronizer.class);

// Azure
synchronizerBinder.addBinding("abfs").to(AzureTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
synchronizerBinder.addBinding("abfss").to(AzureTransactionLogSynchronizer.class).in(Scopes.SINGLETON);

// GCS
synchronizerBinder.addBinding("gs").to(GcsTransactionLogSynchronizer.class).in(Scopes.SINGLETON);

// S3
jsonCodecBinder(binder).bindJsonCodec(S3NativeTransactionLogSynchronizer.LockFileContents.class);
logSynchronizerMapBinder.addBinding("s3").to(S3NativeTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
logSynchronizerMapBinder.addBinding("s3a").to(S3NativeTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
logSynchronizerMapBinder.addBinding("s3n").to(S3NativeTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
synchronizerBinder.addBinding("s3").to(S3NativeTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
synchronizerBinder.addBinding("s3a").to(S3NativeTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
synchronizerBinder.addBinding("s3n").to(S3NativeTransactionLogSynchronizer.class).in(Scopes.SINGLETON);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,13 @@ public static Connector createConnector(
new JsonModule(),
new MBeanServerModule(),
new HdfsModule(),
new DeltaLakeS3Module(),
new DeltaLakeAzureModule(),
new HiveGcsModule(),
new DeltaLakeGcsModule(),
new HdfsAuthenticationModule(),
new CatalogNameModule(catalogName),
metastoreModule.orElse(new DeltaLakeMetastoreModule()),
new DeltaLakeModule(),
new DeltaLakeSecurityModule(),
new DeltaLakeSynchronizerModule(),
fileSystemFactory
.map(factory -> (Module) binder -> binder.bind(TrinoFileSystemFactory.class).toInstance(factory))
.orElseGet(FileSystemModule::new),
Expand Down

0 comments on commit c6d19de

Please sign in to comment.