Search in sources :

Example 1 with ExportedBlockKeysProto

use of org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.ExportedBlockKeysProto in project hadoop by apache.

the class PBHelper method convert.

public static ExportedBlockKeysProto convert(ExportedBlockKeys keys) {
    ExportedBlockKeysProto.Builder builder = ExportedBlockKeysProto.newBuilder();
    builder.setIsBlockTokenEnabled(keys.isBlockTokenEnabled()).setKeyUpdateInterval(keys.getKeyUpdateInterval()).setTokenLifeTime(keys.getTokenLifetime()).setCurrentKey(convert(keys.getCurrentKey()));
    for (BlockKey k : keys.getAllKeys()) {
        builder.addAllKeys(convert(k));
    }
    return builder.build();
}
Also used : ExportedBlockKeysProto(org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.ExportedBlockKeysProto) BlockKey(org.apache.hadoop.hdfs.security.token.block.BlockKey)

Example 2 with ExportedBlockKeysProto

use of org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.ExportedBlockKeysProto in project hadoop by apache.

the class TestPBHelper method testConvertExportedBlockKeys.

@Test
public void testConvertExportedBlockKeys() {
    BlockKey[] keys = new BlockKey[] { getBlockKey(2), getBlockKey(3) };
    ExportedBlockKeys expKeys = new ExportedBlockKeys(true, 9, 10, getBlockKey(1), keys);
    ExportedBlockKeysProto expKeysProto = PBHelper.convert(expKeys);
    ExportedBlockKeys expKeys1 = PBHelper.convert(expKeysProto);
    compare(expKeys, expKeys1);
}
Also used : ExportedBlockKeysProto(org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.ExportedBlockKeysProto) ExportedBlockKeys(org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys) BlockKey(org.apache.hadoop.hdfs.security.token.block.BlockKey) Test(org.junit.Test)

Aggregations

ExportedBlockKeysProto (org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.ExportedBlockKeysProto)2 BlockKey (org.apache.hadoop.hdfs.security.token.block.BlockKey)2 ExportedBlockKeys (org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys)1 Test (org.junit.Test)1