org.apache.ignite.binary.BinaryWriter Java Examples

The following examples show how to use org.apache.ignite.binary.BinaryWriter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlatformDotNetSessionSetAndUnlockProcessor.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter raw = writer.rawWriter();

    raw.writeUuid(lockNodeId);
    raw.writeLong(lockId);
    raw.writeBoolean(update);

    if (update) {
        raw.writeBoolean(isDiff);
        raw.writeByteArray(staticData);
        raw.writeInt(timeout);

        if (items != null) {
            raw.writeInt(items.size());

            for (Map.Entry<String, byte[]> e : items.entrySet()) {
                raw.writeString(e.getKey());
                raw.writeByteArray(e.getValue());
            }
        }
        else
            raw.writeInt(-1);
    }
}
 
Example #2
Source File: IgniteProducerConfig.java    From joyqueue with Apache License 2.0 6 votes vote down vote up
@Override
public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeString(COLUMN_ID, getId());
    writer.writeString(COLUMN_TOPIC,producer.getTopic().getCode());
    writer.writeString(COLUMN_NAMESPACE, producer.getTopic().getNamespace());
    writer.writeString(COLUMN_APP, producer.getApp());
    if (null != producerPolicy) {
        writer.writeBoolean(COLUMN_NEAR_BY, producerPolicy.getNearby());
        writer.writeBoolean(COLUMN_ARCHIVE, producerPolicy.getArchive());
        writer.writeBoolean(COLUMN_SINGLE, producerPolicy.isSingle());
        if (null != producerPolicy.getBlackList())
            writer.writeString(COLUMN_BLACK_LIST, StringUtils.join(producerPolicy.getBlackList(),","));
        if (null != producerPolicy.getWeight() && producerPolicy.getWeight().size() > 0) {
            StringBuilder stringBuilder = new StringBuilder();
            for (Map.Entry<String, Short> entry : producerPolicy.getWeight().entrySet()) {
                stringBuilder.append(entry.getKey()).append(":").append(entry.getValue()).append(",");
            }
            writer.writeString(COLUMN_WEIGHT, stringBuilder.substring(0, stringBuilder.length() - 1).toString());
        }
    }
    writer.writeInt(COLUMN_TIMEOUT, producerPolicy.getTimeOut());
    if (limitPolicy != null) {
        writer.writeInt(COLUMN_LIMIT_TPS, limitPolicy.getTps());
        writer.writeInt(COLUMN_LIMIT_TRAFFIC, limitPolicy.getTraffic());
    }
}
 
Example #3
Source File: IgfsMetaFileCreateProcessor.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeLong(accessTime);
    out.writeLong(modificationTime);

    IgfsUtils.writeProperties(out, props);

    out.writeInt(blockSize);
    BinaryUtils.writeIgniteUuid(out, affKey);
    BinaryUtils.writeIgniteUuid(out, lockId);
    out.writeBoolean(evictExclude);

    out.writeLong(len);
}
 
Example #4
Source File: IgniteComputeConfigVariationsFullApiTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param writer Writer.
 * @param isVal boolean value.
 * @param bVal byte value.
 * @param cVal char value.
 * @param sVal short value.
 * @param intVal int value.
 * @param lVal long value.
 * @param fltVal float value.
 * @param dblVal double value.
 * @param strVal String value.
 * @param arrVal Array value.
 * @param eVal Enum value.
 * @throws BinaryObjectException If failed.
 */
private static void writeJobState(BinaryWriter writer, boolean isVal, byte bVal, char cVal, short sVal,
    int intVal, long lVal, float fltVal, double dblVal, String strVal,
    Object[] arrVal, TestJobEnum eVal) throws BinaryObjectException {
    writer.writeBoolean("isVal", isVal);
    writer.writeByte("bVal", bVal);
    writer.writeChar("cVal", cVal);
    writer.writeShort("sVal", sVal);
    writer.writeInt("intVal", intVal);
    writer.writeLong("lVal", lVal);
    writer.writeFloat("fltVal", fltVal);
    writer.writeDouble("dblVal", dblVal);
    writer.writeString("strVal", strVal);
    writer.writeObjectArray("arrVal", arrVal);
    writer.writeEnum("eVal", eVal);
}
 
Example #5
Source File: IgfsMetaFileUnlockProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeLong(modificationTime);

    if (updateSpace) {
        out.writeBoolean(true);
        out.writeLong(space);
        out.writeObject(affRange);
    }
    else
        out.writeBoolean(false);
}
 
Example #6
Source File: CacheOffheapBatchIndexingBaseTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeInt("id", id);
    writer.writeInt("orgId", orgId);
    writer.writeString("firstName", firstName);
    writer.writeString("lastName", lastName);
    writer.writeDouble("salary", salary);
}
 
Example #7
Source File: BinaryMarshallerSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeInt("val1", val1);

    if (idx > 0)
        writer.writeInt("val2", val2);

    if (idx > 1)
        writer.writeInt("val3", val3);
}
 
Example #8
Source File: IgfsMetaDirectoryListingReplaceProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeString(name);
    BinaryUtils.writeIgniteUuid(out, id);
}
 
Example #9
Source File: IgfsMetaDirectoryListingAddProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeString(fileName);

    IgfsUtils.writeListingEntry(out, entry);
}
 
Example #10
Source File: WebSessionAttributeProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(final BinaryWriter writer) throws BinaryObjectException {
    final BinaryRawWriter rawWriter = writer.rawWriter();

    rawWriter.writeMap(updatesMap);
    rawWriter.writeLong(accessTime);
    rawWriter.writeBoolean(maxIntervalChanged);

    if (maxIntervalChanged)
        rawWriter.writeInt(maxInactiveInterval);
}
 
Example #11
Source File: IgfsPathSummary.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter rawWriter = writer.rawWriter();

    rawWriter.writeInt(filesCnt);
    rawWriter.writeInt(dirCnt);
    rawWriter.writeLong(totalLen);

    IgfsUtils.writePath(rawWriter, path);
}
 
Example #12
Source File: IgnitePartitionGroupReplica.java    From joyqueue with Apache License 2.0 5 votes vote down vote up
@Override
public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeString(COLUMN_ID, getId());
    writer.writeString(COLUMN_NAMESPACE, topic.getNamespace());
    writer.writeString(COLUMN_TOPIC, topic.getCode());
    writer.writeInt(COLUMN_BROKER_ID, brokerId);
    writer.writeInt(COLUMN_GROUP_NO, group);
}
 
Example #13
Source File: IgniteConsumer.java    From joyqueue with Apache License 2.0 5 votes vote down vote up
@Override
public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeString(COLUMN_ID, getId());
    writer.writeString(COLUMN_TOPIC, topic.getCode());
    writer.writeString(COLUMN_NAMESPACE, topic.getNamespace());
    writer.writeString(COLUMN_APP, app);
    writer.writeByte(COLUMN_CLIENT_TYPE, clientType.value());
    writer.writeByte(COLUMN_TOPIC_TYPE, topicType.code());
    writer.writeString(COLUMN_REFER, app.split(SEPARATOR_SPLIT)[0]);
}
 
Example #14
Source File: IgniteAppToken.java    From joyqueue with Apache License 2.0 5 votes vote down vote up
@Override
public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeLong(COLUMN_ID, id);
    writer.writeString(COLUMN_APP, app);
    writer.writeString(COLUMN_TOKEN, token);
    writer.writeDate(COLUMN_EFFECTIVE_TIME, effectiveTime);
    writer.writeDate(COLUMN_EXPIRATION_TIME, expirationTime);
}
 
Example #15
Source File: IgniteConsumerConfig.java    From joyqueue with Apache License 2.0 5 votes vote down vote up
@Override
public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeString(COLUMN_ID, getId());
    writer.writeString(COLUMN_TOPIC,  consumer.getTopic().getCode());
    writer.writeString(COLUMN_NAMESPACE,  consumer.getTopic().getNamespace());
    writer.writeString(COLUMN_APP, consumer.getApp());
    if (null != consumerPolicy) {
        writer.writeBoolean(COLUMN_NEAR_BY, consumerPolicy.getNearby());
        writer.writeBoolean(COLUMN_ARCHIVE, consumerPolicy.getArchive());
        writer.writeBoolean(COLUMN_RETRY, consumerPolicy.getRetry());
        writer.writeBoolean(COLUMN_PAUSED,consumerPolicy.getPaused());
        writer.writeInt(COLUMN_ACK_TIMEOUT, consumerPolicy.getAckTimeout());
        writer.writeShort(COLUMN_BATCH_SIZE, consumerPolicy.getBatchSize());
        writer.writeInt(COLUMN_CONCURRENT, consumerPolicy.getConcurrent());
        writer.writeInt(COLUMN_ERROR_TIMES,consumerPolicy.getErrTimes());
        writer.writeInt(COLUMN_MAX_PARTITION_NUM,consumerPolicy.getMaxPartitionNum());
        writer.writeInt(COLUMN_RETRY_READ_PROBABILITY,consumerPolicy.getReadRetryProbability());
        writer.writeMap(COLUMN_FILTERS,consumerPolicy.getFilters());
        if (null != consumerPolicy.getBlackList())
            writer.writeString(COLUMN_BLACK_LIST,StringUtils.join(consumerPolicy.getBlackList(),","));
        writer.writeInt(COLUMN_DELAY, consumerPolicy.getDelay());
    }
    if (null != retryPolicy) {
        writer.writeInt(COLUMN_MAX_RETRYS, retryPolicy.getMaxRetrys());
        writer.writeInt(COLUMN_MAX_RETRY_DELAY, retryPolicy.getMaxRetryDelay());
        writer.writeInt(COLUMN_RETRY_DELAY, retryPolicy.getRetryDelay());
        writer.writeInt(COLUMN_EXPIRE_TIME, retryPolicy.getExpireTime());
    }
    if (limitPolicy != null) {
        writer.writeInt(COLUMN_LIMIT_TPS, limitPolicy.getTps());
        writer.writeInt(COLUMN_LIMIT_TRAFFIC, limitPolicy.getTraffic());
    }
}
 
Example #16
Source File: BinaryMarshallerSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    writer.writeDecimal("val", val);
    writer.writeDecimalArray("valArr", valArr);

    BinaryRawWriter rawWriter = writer.rawWriter();

    rawWriter.writeDecimal(rawVal);
    rawWriter.writeDecimalArray(rawValArr);
}
 
Example #17
Source File: WebSessionEntity.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(final BinaryWriter writer) throws BinaryObjectException {
    final BinaryRawWriter rawWriter = writer.rawWriter();

    rawWriter.writeString(id);
    rawWriter.writeLong(createTime);
    rawWriter.writeLong(accessTime);
    rawWriter.writeInt(maxInactiveInterval);
    rawWriter.writeMap(attrs);
}
 
Example #18
Source File: IgfsMetaDirectoryCreateProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeLong(accessTime);
    out.writeLong(modificationTime);

    IgfsUtils.writeProperties(out, props);

    out.writeString(childName);

    if (childName != null)
        IgfsUtils.writeListingEntry(out, childEntry);
}
 
Example #19
Source File: IgniteUuid.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeLong(locId);
    out.writeLong(gid.getMostSignificantBits());
    out.writeLong(gid.getLeastSignificantBits());
}
 
Example #20
Source File: IgfsMetaFileReserveSpaceProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeLong(space);
    out.writeObject(affRange);
}
 
Example #21
Source File: IgfsMetaDirectoryListingRemoveProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeString(fileName);
    BinaryUtils.writeIgniteUuid(out, fileId);
}
 
Example #22
Source File: IgfsMetaDirectoryListingRenameProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeString(oldName);
    out.writeString(newName);
}
 
Example #23
Source File: IgfsMetaUpdateTimesProcessor.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    out.writeLong(accessTime);
    out.writeLong(modificationTime);
}
 
Example #24
Source File: IgfsFileImpl.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter rawWriter = writer.rawWriter();

    IgfsUtils.writePath(rawWriter, path);
    rawWriter.writeInt(blockSize);
    rawWriter.writeLong(grpBlockSize);
    rawWriter.writeLong(len);
    IgfsUtils.writeProperties(rawWriter, props);
    rawWriter.writeLong(accessTime);
    rawWriter.writeLong(modificationTime);
    rawWriter.writeByte(flags);
}
 
Example #25
Source File: BinaryTreeMap.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter rawWriter = writer.rawWriter();

    rawWriter.writeObject(map.comparator());

    int size = map.size();

    rawWriter.writeInt(size);

    for (Map.Entry<Object, Object> entry : ((TreeMap<Object, Object>)map).entrySet()) {
        rawWriter.writeObject(entry.getKey());
        rawWriter.writeObject(entry.getValue());
    }
}
 
Example #26
Source File: IgfsListingEntry.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    BinaryUtils.writeIgniteUuid(out, id);
    out.writeBoolean(dir);
}
 
Example #27
Source File: IgfsClientAbstractCallable.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public final void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter rawWriter = writer.rawWriter();

    rawWriter.writeString(igfsName);
    rawWriter.writeString(user);
    IgfsUtils.writePath(rawWriter, path);

    writeBinary0(rawWriter);
}
 
Example #28
Source File: IgfsBlockKey.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter out = writer.rawWriter();

    BinaryUtils.writeIgniteUuid(out, fileId);
    BinaryUtils.writeIgniteUuid(out, affKey);
    out.writeBoolean(evictExclude);
    out.writeLong(blockId);
}
 
Example #29
Source File: IgfsBlockLocationImpl.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    BinaryRawWriter rawWriter = writer.rawWriter();

    assert names != null;
    assert hosts != null;

    rawWriter.writeLong(start);
    rawWriter.writeLong(len);

    rawWriter.writeBoolean(nodeIds != null);

    if (nodeIds != null) {
        rawWriter.writeInt(nodeIds.size());

        for (UUID nodeId : nodeIds)
            U.writeUuid(rawWriter, nodeId);
    }

    rawWriter.writeInt(names.size());

    for (String name : names)
        rawWriter.writeString(name);

    rawWriter.writeInt(hosts.size());

    for (String host : hosts)
        rawWriter.writeString(host);
}
 
Example #30
Source File: PlatformDotNetEntityFrameworkCacheEntry.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
    final BinaryRawWriter raw = writer.rawWriter();

    if (entitySets != null) {
        raw.writeInt(entitySets.length);

        for (String entitySet : entitySets)
            raw.writeString(entitySet);
    }
    else
        raw.writeInt(-1);

    raw.writeByteArray(data);
}