Tabnine Logo
TieredIdentity.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
alluxio.wire.TieredIdentity
constructor

Best Java code snippets using alluxio.wire.TieredIdentity.<init> (Showing top 19 results out of 315)

origin: Alluxio/alluxio

/**
 * Converts a proto type to a wire type.
 *
 * @param tieredPIdentity the proto type to convert
 * @return the converted wire type
 */
public static TieredIdentity fromProto(alluxio.grpc.TieredIdentity tieredPIdentity) {
 return new TieredIdentity(tieredPIdentity.getTiersList().stream().map(GrpcUtils::fromProto)
   .collect(Collectors.toList()));
}
origin: Alluxio/alluxio

/**
 * @return the tiered identity
 */
public TieredIdentity getTieredIdentity() {
 if (mTieredIdentity != null) {
  return mTieredIdentity;
 }
 return new TieredIdentity(Arrays.asList(new LocalityTier(Constants.LOCALITY_NODE, mHost)));
}
origin: Alluxio/alluxio

 tieredIdentity.add(new LocalityTier(localityTier, value));
return new TieredIdentity(tieredIdentity);
origin: Alluxio/alluxio

public static TieredIdentity createRandomTieredIdentity() {
 return new TieredIdentity(
   Arrays.asList(createRandomLocalityTier(), createRandomLocalityTier()));
}
origin: Alluxio/alluxio

 tiers.set(0, new LocalityTier(Constants.LOCALITY_NODE, name));
return new TieredIdentity(tiers);
origin: Alluxio/alluxio

 private BlockWorkerInfo worker(long capacity, String node, String rack) {
  WorkerNetAddress address = new WorkerNetAddress();
  List<LocalityTier> tiers = new ArrayList<>();
  if (node != null && !node.isEmpty()) {
   address.setHost(node);
   tiers.add(new LocalityTier(Constants.LOCALITY_NODE, node));
  }
  if (rack != null && !rack.isEmpty()) {
   tiers.add(new LocalityTier(Constants.LOCALITY_RACK, rack));
  }
  address.setTieredIdentity(new TieredIdentity(tiers));
  return new BlockWorkerInfo(address, capacity, 0);
 }
}
origin: Alluxio/alluxio

 private BlockWorkerInfo worker(long capacity, long used, String node, String rack) {
  WorkerNetAddress address = new WorkerNetAddress();
  List<LocalityTier> tiers = new ArrayList<>();
  if (node != null && !node.isEmpty()) {
   address.setHost(node);
   tiers.add(new LocalityTier(Constants.LOCALITY_NODE, node));
  }
  if (rack != null && !rack.isEmpty()) {
   tiers.add(new LocalityTier(Constants.LOCALITY_RACK, rack));
  }
  address.setTieredIdentity(new TieredIdentity(tiers));
  return new BlockWorkerInfo(address, capacity, used);
 }
}
origin: Alluxio/alluxio

public void string() {
 TieredIdentity identity = new TieredIdentity(
   Arrays.asList(new LocalityTier("k1", "v1"), new LocalityTier("k2", "v2")));
 assertEquals("TieredIdentity(k1=v1, k2=v2)", identity.toString());
}
origin: Alluxio/alluxio

@Test
public void fromString() throws Exception {
 assertEquals(new TieredIdentity(Arrays.asList(
   new LocalityTier("node", "b"),
   new LocalityTier("rack", "d")
 )), TieredIdentityFactory.fromString("node=b,rack=d", mConfiguration));
}
origin: Alluxio/alluxio

@Test
public void fromScriptClasspath() throws Exception {
 String customScriptName = "my-alluxio-locality.sh";
 File dir = mFolder.newFolder("fromScriptClasspath");
 Whitebox.invokeMethod(ClassLoader.getSystemClassLoader(), "addURL", dir.toURI().toURL());
 File script = new File(dir, customScriptName);
 setupScript("node=myhost,rack=myrack,custom=mycustom", script);
 try (Closeable c = new ConfigurationRule(ImmutableMap.of(
   PropertyKey.LOCALITY_ORDER, "node,rack,custom",
   PropertyKey.LOCALITY_SCRIPT, customScriptName), mConfiguration).toResource()) {
  TieredIdentity identity = TieredIdentityFactory.create(mConfiguration);
  TieredIdentity expected = new TieredIdentity(Arrays.asList(
    new LocalityTier("node", "myhost"),
    new LocalityTier("rack", "myrack"),
    new LocalityTier("custom", "mycustom")));
  assertEquals(expected, identity);
 }
 script.delete();
}
origin: Alluxio/alluxio

@Test
public void defaultConf() throws Exception {
 TieredIdentity identity = TieredIdentityFactory.create(mConfiguration);
 TieredIdentity expected = new TieredIdentity(Arrays.asList(
   new LocalityTier("node", NetworkAddressUtils.getLocalNodeName(mConfiguration)),
   new LocalityTier("rack", null)));
 assertEquals(expected, identity);
}
origin: Alluxio/alluxio

@Test
public void outOfOrderScript() throws Exception {
 String scriptPath = setupScript("rack=myrack,node=myhost", mFolder.newFile());
 try (Closeable c = new ConfigurationRule(ImmutableMap.of(
   PropertyKey.LOCALITY_SCRIPT, scriptPath), mConfiguration).toResource()) {
  TieredIdentity identity = TieredIdentityFactory.create(mConfiguration);
  TieredIdentity expected = new TieredIdentity(Arrays.asList(
    new LocalityTier("node", "myhost"),
    new LocalityTier("rack", "myrack")));
  assertEquals(expected, identity);
 }
}
origin: Alluxio/alluxio

@Test
public void fromScript() throws Exception {
 String scriptPath = setupScript("node=myhost,rack=myrack,custom=mycustom", mFolder.newFile());
 try (Closeable c = new ConfigurationRule(ImmutableMap.of(
   PropertyKey.LOCALITY_ORDER, "node,rack,custom",
   PropertyKey.LOCALITY_SCRIPT, scriptPath), mConfiguration).toResource()) {
  TieredIdentity identity = TieredIdentityFactory.create(mConfiguration);
  TieredIdentity expected = new TieredIdentity(Arrays.asList(
    new LocalityTier("node", "myhost"),
    new LocalityTier("rack", "myrack"),
    new LocalityTier("custom", "mycustom")));
  assertEquals(expected, identity);
 }
}
origin: Alluxio/alluxio

@Test
public void overrideScript() throws Exception {
 String scriptPath = setupScript("node=myhost,rack=myrack,custom=mycustom", mFolder.newFile());
 try (Closeable c = new ConfigurationRule(ImmutableMap.of(
   Template.LOCALITY_TIER.format("node"), "overridden",
   PropertyKey.LOCALITY_ORDER, "node,rack,custom",
   PropertyKey.LOCALITY_SCRIPT, scriptPath), mConfiguration).toResource()) {
  TieredIdentity identity = TieredIdentityFactory.create(mConfiguration);
  TieredIdentity expected = new TieredIdentity(Arrays.asList(
    new LocalityTier("node", "overridden"),
    new LocalityTier("rack", "myrack"),
    new LocalityTier("custom", "mycustom")));
  assertEquals(expected, identity);
 }
}
origin: org.alluxio/alluxio-core-common

/**
 * @param tieredIdentity a Thrift tiered identity
 * @return the corresponding wire type tiered identity
 */
@Nullable
public static TieredIdentity fromThrift(alluxio.thrift.TieredIdentity tieredIdentity) {
 if (tieredIdentity == null) {
  return null;
 }
 return new TieredIdentity(tieredIdentity.getTiers().stream()
   .map(LocalityTier::fromThrift).collect(Collectors.toList()));
}
origin: org.alluxio/alluxio-core-common

/**
 * @return the tiered identity
 */
public TieredIdentity getTieredIdentity() {
 if (mTieredIdentity != null) {
  return mTieredIdentity;
 }
 return new TieredIdentity(Arrays.asList(new LocalityTier(Constants.LOCALITY_NODE, mHost)));
}
origin: org.alluxio/alluxio-core-common

 tieredIdentity.add(new LocalityTier(localityTier, value));
return new TieredIdentity(tieredIdentity);
origin: org.alluxio/alluxio-core-common

 tiers.set(0, new LocalityTier(Constants.LOCALITY_NODE, name));
return new TieredIdentity(tiers);
origin: org.alluxio/alluxio-core-common

/**
 * Creates a new instance of {@link WorkerNetAddress} from thrift representation.
 *
 * @param address the thrift net address
 * @return the instance
 */
public static WorkerNetAddress fromThrift(alluxio.thrift.WorkerNetAddress address) {
 TieredIdentity tieredIdentity = TieredIdentity.fromThrift(address.getTieredIdentity());
 if (tieredIdentity == null) {
  // This means the worker is pre-1.7.0. We handle this in post-1.7.0 clients by filling out
  // the tiered identity using the hostname field.
  tieredIdentity = new TieredIdentity(
    Arrays.asList(new LocalityTier(Constants.LOCALITY_NODE, address.getHost())));
 }
 return new WorkerNetAddress()
   .setDataPort(address.getDataPort())
   .setDomainSocketPath(address.getDomainSocketPath())
   .setHost(address.getHost())
   .setRpcPort(address.getRpcPort())
   .setTieredIdentity(tieredIdentity)
   .setWebPort(address.getWebPort());
}
alluxio.wireTieredIdentity<init>

Popular methods of TieredIdentity

  • getTier
  • getTiers
  • equals
  • fromThrift
  • toString
  • toThrift
  • topTiersMatch

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JList (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now