当前位置: 首页>>代码示例>>Java>>正文


Java RadosObjectInfo类代码示例

本文整理汇总了Java中com.ceph.rados.jna.RadosObjectInfo的典型用法代码示例。如果您正苦于以下问题:Java RadosObjectInfo类的具体用法?Java RadosObjectInfo怎么用?Java RadosObjectInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RadosObjectInfo类属于com.ceph.rados.jna包,在下文中一共展示了RadosObjectInfo类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exists

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
@Override
public boolean exists() {
	IoCTX ioctx = null;
	try {
		ioctx = this.rados.ioCtxCreate(pool);
		RadosObjectInfo stat = ioctx.stat(locator);
		return stat != null;

	} catch (RadosException e) {
		logger.error(e.getMessage(), e);
	} finally {
		if (ioctx != null) {
			this.rados.ioCtxDestroy(ioctx);
		}
	}

	return false;
}
 
开发者ID:jeci-sarl,项目名称:alfresco-object-storage-connectors,代码行数:19,代码来源:CephContentReader.java

示例2: getLastModified

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
@Override
public long getLastModified() {
	IoCTX ioctx = null;

	try {
		ioctx = this.rados.ioCtxCreate(this.pool);
		RadosObjectInfo stat = ioctx.stat(this.locator);
		
		if (stat != null) {
			return stat.getMtime();
		}

	} catch (RadosException e) {
		logger.error(e.getMessage(), e);
	} finally {
		if (ioctx != null) {
			this.rados.ioCtxDestroy(ioctx);
		}
	}
	
	return 0L;
}
 
开发者ID:jeci-sarl,项目名称:alfresco-object-storage-connectors,代码行数:23,代码来源:CephContentReader.java

示例3: getSize

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
@Override
public long getSize() {
	IoCTX ioctx = null;

	try {
		ioctx = this.rados.ioCtxCreate(this.pool);
		RadosObjectInfo stat = ioctx.stat(this.locator);

		if (stat != null) {
			return stat.getSize();
		}

	} catch (RadosException e) {
		logger.error(e.getMessage(), e);
	} finally {
		if (ioctx != null) {
			this.rados.ioCtxDestroy(ioctx);
		}
	}

	return 0L;
}
 
开发者ID:jeci-sarl,项目名称:alfresco-object-storage-connectors,代码行数:23,代码来源:CephContentReader.java

示例4: inodeExists

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
public boolean inodeExists(Path path) throws IOException {
    String key = pathToKey(path);
    try {
        RadosObjectInfo info = get(key);
        if (info == null) {
            if (isRoot(key)) {
                storeINode(path, INode.DIRECTORY_INODE);
                return true;
            } else {
                return false;
            }
        }
    } catch (Exception e) {
        throw new IOException("store inode failed");
    }

    return true;
}
 
开发者ID:rootfs,项目名称:RadosFs,代码行数:19,代码来源:RadosFileSystemStore.java

示例5: blockExists

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
public boolean blockExists(long blockId) throws IOException {
    try {
        RadosObjectInfo info = get(blockToKey(blockId));
        if (info == null) {
            return false;
        }
    } catch (Exception e) {
        throw new IOException("block get failed");
    }

    return true;
}
 
开发者ID:rootfs,项目名称:RadosFs,代码行数:13,代码来源:RadosFileSystemStore.java

示例6: get

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
private RadosObjectInfo get(String key)
    throws Exception {
    RadosObjectInfo info = null;
    try {
        info = ioctx.stat(key);
        return info;
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:rootfs,项目名称:RadosFs,代码行数:11,代码来源:RadosFileSystemStore.java

示例7: retrieveINode

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
public INode retrieveINode(Path path) throws IOException {
    String key = pathToKey(path);
    try {
        RadosObjectInfo info = get(key);

        if (info == null && isRoot(key)) {
            storeINode(path, INode.DIRECTORY_INODE);
            return INode.DIRECTORY_INODE;
        }
        return INode.deserialize(new RadosInputStream(ioctx, info.getOid()));
    } catch (Exception e) {
        throw new IOException("get inode failed");
    }
}
 
开发者ID:rootfs,项目名称:RadosFs,代码行数:15,代码来源:RadosFileSystemStore.java

示例8: retrieveBlock

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
public byte[] retrieveBlock(Block block, long byteRangeStart)
    throws IOException {
    RadosObjectInfo info = null;
    InputStream in = null;
    OutputStream out = null;
    try {
        info = get(blockToKey(block), byteRangeStart);
        if (null == info) {
            throw new IOException("no such object");
        }
        in = new RadosInputStream(ioctx, info.getOid());
        out = new RadosOutputStream(ioctx, info.getOid());
        int bufferSize = in.available() - (int)byteRangeStart;
        byte[] buf = new byte[bufferSize];
        int numRead;
        while ((numRead = in.read(buf)) > 0) {
            out.write(buf, 0, numRead);
        }
        return buf;
    } catch (IOException e) {
        // close output stream to file then delete file
        closeQuietly(out);
        out = null; // to prevent a second close
        throw e;
    } finally {
        closeQuietly(out);
        closeQuietly(in);
    }
}
 
开发者ID:rootfs,项目名称:RadosFs,代码行数:30,代码来源:RadosFileSystemStore.java

示例9: stat

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
/**
 * Stat an object
 *
 * @param oid
 *          The name of the object
 * @return RadosObjectInfo
 *           The size and mtime of the object
 * @throws RadosException
 */
public RadosObjectInfo stat(final String oid) throws RadosException {
    final LongByReference size = new LongByReference();
    final LongByReference mtime = new LongByReference();
    handleReturnCode(new Callable<Integer>() {
        @Override
        public Integer call() throws Exception {
            return rados.rados_stat(getPointer(), oid, size, mtime);
        }
    }, "Failed performing a stat on object %s", oid);
    return new RadosObjectInfo(oid, size.getValue(), mtime.getValue());
}
 
开发者ID:kurthuwig,项目名称:rados-java,代码行数:21,代码来源:IoCTX.java

示例10: verifyDocument

import com.ceph.rados.jna.RadosObjectInfo; //导入依赖的package包/类
private void verifyDocument(String oid, byte[] content) throws RadosException {
    byte[] buf = new byte[content.length];
    int len = ioctx.read(oid, content.length, 0, buf);
    assertEquals(len, content.length);
    RadosObjectInfo info = ioctx.stat(oid);

    assertEquals("The object names didn't match", oid, info.getOid());
    assertEquals("The size of what we wrote doesn't match with the stat", content.length, info.getSize());
    assertTrue("The content we read was different from what we wrote", Arrays.equals(content, buf));

    long now = System.currentTimeMillis() / 1000;
    assertFalse("The mtime was in the future", now < info.getMtime());
}
 
开发者ID:kurthuwig,项目名称:rados-java,代码行数:14,代码来源:TestRados.java


注:本文中的com.ceph.rados.jna.RadosObjectInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。