本文整理了Java中org.apache.gobblin.util.guid.Guid.toString()
方法的一些代码示例,展示了Guid.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.toString()
方法的具体详情如下:
包路径:org.apache.gobblin.util.guid.Guid
类名称:Guid
方法名:toString
[英]Serializes the guid into a hex string. The original Guid can be recovered using #deserialize.
[中]将guid序列化为十六进制字符串。可以使用#反序列化来恢复原始Guid。
代码示例来源:origin: apache/incubator-gobblin
/**
* Set a unique, replicable guid for this work unit. Used for recovering partially successful work units.
* @param state {@link State} where guid should be written.
* @param guid A byte array guid.
*/
public static void setWorkUnitGuid(State state, Guid guid) {
state.setProp(WORK_UNIT_GUID, guid.toString());
}
代码示例来源:origin: apache/incubator-gobblin
@Override
public String getStateStoreNameFromDatasetUrn(String datasetUrn)
throws IOException {
if (!this.sanitizedNameToDatasetURNMap.inverse().containsKey(datasetUrn)) {
String guid = Guid.fromStrings(datasetUrn).toString();
this.sanitizedNameToDatasetURNMap.put(guid, datasetUrn);
}
return this.sanitizedNameToDatasetURNMap.inverse().get(datasetUrn);
}
}
代码示例来源:origin: apache/incubator-gobblin
private static String computeGuid(State state, CopyEntity file) throws IOException {
Optional<Guid> stateGuid = CopySource.getWorkUnitGuid(state);
if (stateGuid.isPresent()) {
return Guid.combine(file.guid(), stateGuid.get()).toString();
}
throw new IOException("State does not contain a guid.");
}
}
代码示例来源:origin: apache/incubator-gobblin
throws IOException {
for (String datasetUrn : datasetUrns) {
String key = Guid.fromStrings(datasetUrn).toString();
if (!this.sanitizedNameToDatasetURNMap.containsKey(key)) {
this.sanitizedNameToDatasetURNMap.put(key, datasetUrn);
代码示例来源:origin: apache/incubator-gobblin
@Test
public void testSerDe() throws Exception {
Random random = new Random();
byte[] b = new byte[10];
random.nextBytes(b);
Guid guid = new Guid(b);
Assert.assertEquals(guid.toString().length(), 2 * Guid.GUID_LENGTH);
Assert.assertEquals(guid, Guid.deserialize(guid.toString()));
}
代码示例来源:origin: apache/incubator-gobblin
@Test(dependsOnMethods = {"testPersistDatasetUrns"})
public void testGetDatasetUrnFromStateStoreName()
throws IOException {
GuidDatasetUrnStateStoreNameParser parser =
new GuidDatasetUrnStateStoreNameParser(this.testFs, this.jobStateRootDir);
Assert.assertEquals(parser.sanitizedNameToDatasetURNMap.size(), 2);
Assert.assertTrue(parser.sanitizedNameToDatasetURNMap.inverse().containsKey("dataset1"));
Assert.assertTrue(parser.sanitizedNameToDatasetURNMap.inverse().containsKey("dataset2"));
Assert.assertEquals(parser.getStateStoreNameFromDatasetUrn("dataset1"), Guid.fromStrings("dataset1").toString());
Assert.assertEquals(parser.getStateStoreNameFromDatasetUrn("dataset2"), Guid.fromStrings("dataset2").toString());
}
代码示例来源:origin: org.apache.gobblin/gobblin-data-management
/**
* Set a unique, replicable guid for this work unit. Used for recovering partially successful work units.
* @param state {@link State} where guid should be written.
* @param guid A byte array guid.
*/
public static void setWorkUnitGuid(State state, Guid guid) {
state.setProp(WORK_UNIT_GUID, guid.toString());
}
代码示例来源:origin: org.apache.gobblin/gobblin-metastore
@Override
public String getStateStoreNameFromDatasetUrn(String datasetUrn)
throws IOException {
if (!this.sanitizedNameToDatasetURNMap.inverse().containsKey(datasetUrn)) {
String guid = Guid.fromStrings(datasetUrn).toString();
this.sanitizedNameToDatasetURNMap.put(guid, datasetUrn);
}
return this.sanitizedNameToDatasetURNMap.inverse().get(datasetUrn);
}
}
代码示例来源:origin: org.apache.gobblin/gobblin-data-management
private static String computeGuid(State state, CopyEntity file) throws IOException {
Optional<Guid> stateGuid = CopySource.getWorkUnitGuid(state);
if (stateGuid.isPresent()) {
return Guid.combine(file.guid(), stateGuid.get()).toString();
}
throw new IOException("State does not contain a guid.");
}
}
代码示例来源:origin: org.apache.gobblin/gobblin-metastore
throws IOException {
for (String datasetUrn : datasetUrns) {
String key = Guid.fromStrings(datasetUrn).toString();
if (!this.sanitizedNameToDatasetURNMap.containsKey(key)) {
this.sanitizedNameToDatasetURNMap.put(key, datasetUrn);
内容来源于网络,如有侵权,请联系作者删除!