use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformClusterNodeFilterImpl method apply.
/** {@inheritDoc} */
@Override
public boolean apply(ClusterNode clusterNode) {
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = ctx.writer(out);
writer.writeObject(pred);
ctx.writeNode(writer, clusterNode);
out.synchronize();
return ctx.gateway().clusterNodeFilterApply(mem.pointer()) != 0;
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformProcessorImpl method getIgniteConfiguration.
/** {@inheritDoc} */
@Override
public void getIgniteConfiguration(long memPtr) {
PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
BinaryRawWriterEx writer = platformCtx.writer(stream);
PlatformConfigurationUtils.writeIgniteConfiguration(writer, ignite().configuration());
stream.synchronize();
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformProcessorImpl method getCacheNames.
/** {@inheritDoc} */
@Override
public void getCacheNames(long memPtr) {
PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
BinaryRawWriterEx writer = platformCtx.writer(stream);
Collection<String> names = ignite().cacheNames();
writer.writeInt(names.size());
for (String name : names) writer.writeString(name);
stream.synchronize();
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformDotNetCacheStore method loadAll.
/** {@inheritDoc} */
@Override
public Map<K, V> loadAll(final Iterable<? extends K> keys) {
try {
final Map<K, V> loaded = new HashMap<>();
final Collection keys0 = (Collection) keys;
doInvoke(new IgniteInClosureX<BinaryRawWriterEx>() {
@Override
public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException {
writer.writeByte(OP_LOAD_ALL);
writer.writeLong(session());
writer.writeString(ses.cacheName());
writer.writeInt(keys0.size());
for (Object o : keys0) writer.writeObject(o);
}
}, new IgniteInClosureX<BinaryRawReaderEx>() {
@Override
public void applyx(BinaryRawReaderEx reader) {
int cnt = reader.readInt();
for (int i = 0; i < cnt; i++) loaded.put((K) reader.readObjectDetached(), (V) reader.readObjectDetached());
}
});
return loaded;
} catch (IgniteCheckedException e) {
throw new CacheLoaderException(e);
}
}
use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformDotNetCacheStore method doInvoke.
/**
* Perform actual invoke.
*
* @param task Task.
* @param readClo Reader.
* @return Result.
* @throws org.apache.ignite.IgniteCheckedException If failed.
*/
protected int doInvoke(IgniteInClosure<BinaryRawWriterEx> task, IgniteInClosure<BinaryRawReaderEx> readClo) throws IgniteCheckedException {
try (PlatformMemory mem = platformCtx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx writer = platformCtx.writer(out);
writer.writeLong(ptr);
task.apply(writer);
out.synchronize();
int res = platformCtx.gateway().cacheStoreInvoke(mem.pointer());
if (res != 0) {
// Read error
Object nativeErr = platformCtx.reader(mem.input()).readObjectDetached();
throw platformCtx.createNativeException(nativeErr);
}
if (readClo != null) {
BinaryRawReaderEx reader = platformCtx.reader(mem);
readClo.apply(reader);
}
return res;
}
}
Aggregations