Search in sources :

Example 1 with RpcVoid

use of org.apache.crail.rpc.RpcVoid in project incubator-crail by apache.

the class StorageRpcClient method setBlock.

public void setBlock(long lba, long addr, int length, int key) throws Exception {
    InetSocketAddress inetAddress = serverAddress;
    DataNodeInfo dnInfo = new DataNodeInfo(storageType, storageClass.value(), locationClass.value(), inetAddress.getAddress().getAddress(), inetAddress.getPort());
    BlockInfo blockInfo = new BlockInfo(dnInfo, lba, addr, length, key);
    RpcVoid res = rpcConnection.setBlock(blockInfo).get(CrailConstants.RPC_TIMEOUT, TimeUnit.MILLISECONDS);
    if (res.getError() != RpcErrors.ERR_OK) {
        LOG.info("setBlock: " + RpcErrors.messages[res.getError()]);
        throw new IOException("setBlock: " + RpcErrors.messages[res.getError()]);
    }
}
Also used : RpcVoid(org.apache.crail.rpc.RpcVoid) InetSocketAddress(java.net.InetSocketAddress) BlockInfo(org.apache.crail.metadata.BlockInfo) DataNodeInfo(org.apache.crail.metadata.DataNodeInfo) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 BlockInfo (org.apache.crail.metadata.BlockInfo)1 DataNodeInfo (org.apache.crail.metadata.DataNodeInfo)1 RpcVoid (org.apache.crail.rpc.RpcVoid)1