use of com.navercorp.pinpoint.hbase.schema.core.CheckSum in project pinpoint by naver.
the class CheckSumTest method computeAndParse.
@Test
public void computeAndParse() {
String randomValue = UUID.randomUUID().toString();
CheckSum checkSum = CheckSum.compute(CheckSum.getCurrentVersion(), randomValue);
CheckSum parsedCheckSum = CheckSum.parse(checkSum.toString());
Assert.assertEquals(checkSum.getVersion(), parsedCheckSum.getVersion());
Assert.assertEquals(checkSum.getCheckSum(), parsedCheckSum.getCheckSum());
}
use of com.navercorp.pinpoint.hbase.schema.core.CheckSum in project pinpoint by naver.
the class SchemaChangeLogCodec method readData.
@Override
public SchemaChangeLog readData(byte[] data) {
if (data == null) {
return null;
}
final Buffer buffer = new FixedBuffer(data);
short version = buffer.readShort();
if (version == 1) {
String id = buffer.readPrefixedString();
long execTimestamp = buffer.readLong();
int execOrder = buffer.readInt();
CheckSum checkSum = new CheckSum(buffer.readInt(), buffer.readPrefixedString());
String value = buffer.readPrefixedString();
return new SchemaChangeLog.Builder().id(id).execTimestamp(execTimestamp).execOrder(execOrder).checkSum(checkSum).value(value).build();
}
throw new IllegalStateException("Unsupported schema change log version : " + version);
}
use of com.navercorp.pinpoint.hbase.schema.core.CheckSum in project pinpoint by naver.
the class SchemaChangeLogCodec method writeData.
@Override
public byte[] writeData(SchemaChangeLog schemaChangeLog) {
final Buffer buffer = new AutomaticBuffer();
buffer.putShort(CURRENT_VERSION);
buffer.putPrefixedString(schemaChangeLog.getId());
buffer.putLong(schemaChangeLog.getExecTimestamp());
buffer.putInt(schemaChangeLog.getExecOrder());
CheckSum checkSum = schemaChangeLog.getCheckSum();
buffer.putInt(checkSum.getVersion());
buffer.putPrefixedString(checkSum.getCheckSum());
buffer.putPrefixedString(schemaChangeLog.getValue());
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.hbase.schema.core.CheckSum in project pinpoint by naver.
the class SchemaChangeLogServiceImpl method recordChangeSet.
private SchemaChangeLog recordChangeSet(String namespace, long executionTimestamp, int executionOrder, ChangeSet changeSet) {
CheckSum checkSum = CheckSum.compute(CheckSum.getCurrentVersion(), changeSet.getValue());
SchemaChangeLog schemaChangeLog = new SchemaChangeLog.Builder().id(changeSet.getId()).execTimestamp(executionTimestamp).execOrder(executionOrder).checkSum(checkSum).value(changeSet.getValue()).build();
schemaChangeLogDao.insertChangeLog(namespace, schemaChangeLog);
return schemaChangeLog;
}
Aggregations