Skip to content

Commit

Permalink
Add temporary hack to use local machine from ServiceSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
erichwang committed Nov 20, 2012
1 parent 3eb2b9a commit 75fbf5f
Showing 1 changed file with 20 additions and 1 deletion.
Expand Up @@ -29,14 +29,21 @@
import com.facebook.presto.split.ImportDataStreamProvider;
import com.facebook.presto.split.NativeDataStreamProvider;
import com.facebook.presto.split.SplitManager;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import io.airlift.discovery.client.ServiceDescriptor;
import io.airlift.discovery.client.ServiceSelector;
import io.airlift.discovery.client.ServiceState;
import io.airlift.discovery.client.ServiceTypes;
import io.airlift.discovery.client.testing.StaticServiceSelector;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.IDBI;

import javax.inject.Singleton;
import java.util.UUID;

import static io.airlift.discovery.client.DiscoveryBinder.discoveryBinder;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
Expand Down Expand Up @@ -69,7 +76,19 @@ public void configure(Binder binder)

jsonCodecBinder(binder).bindJsonCodec(QueryFragmentRequest.class);

discoveryBinder(binder).bindSelector("presto");
// TODO: add a proper way to add a testing discovery service
//discoveryBinder(binder).bindSelector("presto");
binder.bind(ServiceSelector.class).annotatedWith(ServiceTypes.serviceType("presto"))
.toInstance(new StaticServiceSelector(new ServiceDescriptor(
UUID.randomUUID(),
"myid",
"default",
"local",
"localhost",
ServiceState.RUNNING,
ImmutableMap.<String, String>of("http", "http://localhost:8080")
)));

binder.bind(NodeManager.class).in(Scopes.SINGLETON);
binder.bind(NodeWorkerQueue.class).in(Scopes.SINGLETON);
binder.bind(ShardManager.class).to(DatabaseShardManager.class).in(Scopes.SINGLETON);
Expand Down

0 comments on commit 75fbf5f

Please sign in to comment.