本文整理了Java中org.apache.ignite.Ignite.fileSystem()
方法的一些代码示例,展示了Ignite.fileSystem()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.fileSystem()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:fileSystem
[英]Gets an instance of IGFS (Ignite In-Memory File System). If one is not configured then IllegalArgumentException will be thrown.
IGFS is fully compliant with Hadoop FileSystem APIs and can be plugged into Hadoop installations. For more information refer to documentation on Hadoop integration shipped with Ignite.
[中]获取IGFS(Ignite-In-Memory文件系统)的实例。如果未配置,则将抛出IllegalArgumentException。
IGFS完全符合Hadoop文件系统API,可以插入Hadoop安装。有关更多信息,请参阅Ignite附带的Hadoop集成文档。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteFileSystem fileSystem(String name) {
checkIgnite();
return g.fileSystem(name);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public final T call() throws Exception {
assert ignite != null;
final IgfsEx igfs = (IgfsEx)ignite.fileSystem(igfsName);
if (user != null) {
return IgfsUserContext.doAs(user, new Callable<T>() {
@Override public T call() throws Exception {
return call0(igfs.context());
}
});
} else
return call0(igfs.context());
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
chunk = new byte[128];
for (int i = 0; i < chunk.length; i++)
chunk[i] = (byte)i;
Ignite igniteSecondary = startGridWithIgfs("grid-secondary", "igfs-secondary", PRIMARY, null, SECONDARY_REST_CFG);
IgfsSecondaryFileSystem hadoopFs = new IgniteHadoopIgfsSecondaryFileSystem(SECONDARY_URI, SECONDARY_CFG);
Ignite ignite = startGridWithIgfs("grid", "igfs", mode, hadoopFs, PRIMARY_REST_CFG);
igfsSecondary = (IgfsImpl) igniteSecondary.fileSystem("igfs-secondary");
igfs = (IgfsImpl) ignite.fileSystem("igfs");
}
代码示例来源:origin: apache/ignite
/**
* Start a grid with the primary file system.
*
* @throws Exception If failed.
*/
private void startPrimary() throws Exception {
igfsPrimary = new IgniteFileSystem[NODES_CNT];
for (int i = 0; i < NODES_CNT; i++) {
Ignite g = G.start(primaryConfiguration(i));
igfsPrimary[i] = g.fileSystem(IGFS_PRIMARY);
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
for (int i = 0; i < NODE_CNT; i++) {
Ignite g = G.start(config(i));
if (i + 1 == NODE_CNT)
igfs = g.fileSystem("igfs");
}
}
代码示例来源:origin: apache/ignite
@Override public Void call() throws Exception {
IgniteFileSystem igfs = attacker.fileSystem(IGFS_NAME);
try (IgfsOutputStream out = igfs.create(path, true)) {
writeStartLatch.await();
out.write(new byte[1024]);
out.flush();
}
return null;
}
});
代码示例来源:origin: apache/ignite
/**
* Perform startup.
*
* @param dfltIgniteInstanceName Default Ignite instance name.
* @param dfltIgfsName Default IGFS name.
* @throws Exception If failed.
*/
private void startUp(boolean dfltIgniteInstanceName, boolean dfltIgfsName) throws Exception {
Ignite ignite = G.start(gridConfiguration(dfltIgniteInstanceName));
IgniteFileSystem igfs = ignite.fileSystem(dfltIgfsName ? "" : IGFS_NAME);
igfs.mkdirs(PATH);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
igfs = (IgfsEx)startGrids(gridCount()).fileSystem(igfsName);
}
代码示例来源:origin: apache/ignite
/**
* Creates secondary file system stack.
*
* @return The secondary file system.
* @throws Exception On error.
*/
protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception {
Ignite igniteSecondary = startGridWithIgfs("ignite-secondary", "igfs-secondary", PRIMARY, null,
SECONDARY_REST_CFG, secondaryIpFinder);
IgfsEx secondaryIgfsImpl = (IgfsEx) igniteSecondary.fileSystem("igfs-secondary");
igfsSecondary = new DefaultIgfsSecondaryFileSystemTestAdapter(secondaryIgfsImpl);
return secondaryIgfsImpl.asSecondary();
}
代码示例来源:origin: apache/ignite
/**
* Start a grid with the secondary file system.
*
* @return Secondary file system handle.
* @throws Exception If failed.
*/
@Nullable private IgniteFileSystem startSecondary() throws Exception {
IgniteConfiguration cfg = getConfiguration("grid-secondary", getSecondaryIgfsConfiguration());
cfg.setLocalHost("127.0.0.1");
cfg.setPeerClassLoadingEnabled(false);
Ignite secG = G.start(cfg);
return secG.fileSystem("igfs-secondary");
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
beforeHadoopCommandLineTest();
String cfgPath = "config/hadoop/default-config.xml";
IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> tup = IgnitionEx.loadConfiguration(cfgPath);
IgniteConfiguration cfg = tup.get1();
cfg.setLocalHost("127.0.0.1"); // Avoid connecting to other nodes.
igfs = (IgfsEx) Ignition.start(cfg).fileSystem(igfsName);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
igfsSecondaryFileSystem = createSecondaryFileSystemStack();
nodes = new Ignite[nodeCount()];
for (int i = 0; i < nodes.length; i++) {
String nodeName = i == 0 ? "ignite" : "ignite" + i;
nodes[i] = startGridWithIgfs(nodeName, "igfs", mode, igfsSecondaryFileSystem, PRIMARY_REST_CFG,
primaryIpFinder);
}
igfs = (IgfsImpl) nodes[0].fileSystem("igfs");
if (client()) {
// Start client.
Ignition.setClientMode(true);
try {
Ignite ignite = startGridWithIgfs("ignite-client", "igfs", mode, igfsSecondaryFileSystem,
PRIMARY_REST_CFG, primaryIpFinder);
igfs = (IgfsImpl) ignite.fileSystem("igfs");
}
finally {
Ignition.setClientMode(false);
}
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
nodeDatas = new NodeFsData[numIgfsNodes];
for (int i = 0; i<numIgfsNodes; i++) {
NodeFsData data = new NodeFsData();
data.idx = i;
data.ignite = startGridWithIgfs(getTestIgniteInstanceName(i), igfsMode, null);
data.igfsImpl = (IgfsImpl) data.ignite.fileSystem("igfs");
nodeDatas[i] = data;
}
// Ensure all the nodes are started and discovered each other:
checkTopology(numIgfsNodes);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Object execute() {
IgniteFileSystem fs = ignite.fileSystem(igfsName);
try (IgfsInputStream in = fs.open(path)) {
IgfsFileRange split = new IgfsFileRange(path, start, len);
if (rslvr != null) {
split = rslvr.resolveRecords(fs, in, split);
if (split == null) {
log.warning("No data found for split on local node after resolver is applied " +
"[igfsName=" + igfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']');
return null;
}
}
in.seek(split.start());
return job.execute(fs, new IgfsFileRange(path, split.start(), split.length()), in);
}
catch (IOException e) {
throw new IgniteException("Failed to execute IGFS job for file split [igfsName=" + igfsName +
", path=" + path + ", start=" + start + ", len=" + len + ']', e);
}
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testInjectPrimaryByField() throws Exception {
secondary = new TestBaseSecondaryFsMock() {
@FileSystemResource
private IgfsImpl igfs;
@LoggerResource
private IgniteLogger log;
@IgniteInstanceResource
private Ignite ig;
@Override boolean checkInjection(Ignite ignite, IgniteFileSystem primary) {
return igfs == primary && log instanceof IgniteLogger && ig == ignite;
}
};
Ignite ig = startGrid(0);
IgniteFileSystem igfs = ig.fileSystem(IGFS_NAME);
assert secondary.checkInjection(ig, igfs);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testCacheStart() throws Exception {
Ignite g0 = G.start(config(true, 0));
String dataCacheName = ((IgniteEx)g0).igfsx("igfs").configuration().getDataCacheConfiguration().getName();
String metaCacheName = ((IgniteEx)g0).igfsx("igfs").configuration().getMetaCacheConfiguration().getName();
checkIgfsCaches(g0, dataCacheName, metaCacheName);
Ignite g1 = G.start(config(false, 1));
checkIgfsCaches(g1, dataCacheName, metaCacheName);
IgniteFileSystem igfs = g0.fileSystem("igfs");
igfs.mkdirs(new IgfsPath("/test"));
try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(igfs.create(
new IgfsPath("/test/test.file"), true)))) {
for (int i = 0; i < 1000; i++)
bw.write("test-" + i);
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs");
igfsCfg.setBlockSize(512);
igfsCfg.setDefaultMode(PRIMARY);
CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
dataCacheCfg.setNearConfiguration(new NearCacheConfiguration());
dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("grid");
cfg.setFileSystemConfiguration(igfsCfg);
Ignite g = G.start(cfg);
igfs = g.fileSystem("igfs");
}
代码示例来源:origin: apache/ignite
igfsSecondary = (IgfsImpl)g.fileSystem(IGFS_SECONDARY);
代码示例来源:origin: apache/ignite
cfg.setConnectorConfiguration(null);
igfsSecondary = (IgfsImpl)G.start(cfg).fileSystem("igfs-secondary");
代码示例来源:origin: apache/ignite
secondaryFs = (IgfsImpl)g.fileSystem(IGFS_SECONDARY);
内容来源于网络,如有侵权,请联系作者删除!