com.aerospike.client.Value Java Examples

The following examples show how to use com.aerospike.client.Value. 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: AerospikeKey.java    From aerospike-hadoop with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    try {
        namespace = in.readUTF();
        setName = in.readUTF();
        int digestLen = in.readInt();
        digest = new byte[digestLen];
        in.readFully(digest);
        if (in.readBoolean()) {
            int buflen = in.readInt();
            byte[] buff = new byte[buflen];
            in.readFully(buff);
            ObjectUnpacker unpack = new ObjectUnpacker(buff, 0, buff.length);
            userKey = Value.get(unpack.unpackObject());
        }
    }
    catch (Exception ex) {
        throw new IOException(ex);
    }
}
 
Example #2
Source File: AerospikeKey.java    From deep-spark with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    try {
        namespace = in.readUTF();
        setName = in.readUTF();
        int digestLen = in.readInt();
        digest = new byte[digestLen];
        in.readFully(digest);
        if (in.readBoolean()) {
            int buflen = in.readInt();
            byte[] buff = new byte[buflen];
            in.readFully(buff);
            ObjectUnpacker unpack = new ObjectUnpacker(buff, 0, buff.length);
            userKey = Value.get(unpack.unpackObject());
        }
    }
    catch (Exception ex) {
        throw new IOException(ex);
    }
}
 
Example #3
Source File: AerospikeAbstractSink.java    From pulsar with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Record<byte[]> record) {
    KeyValue<K, V> keyValue = extractKeyValue(record);
    Key key = new Key(aerospikeSinkConfig.getKeyspace(), aerospikeSinkConfig.getKeySet(), keyValue.getKey().toString());
    Bin bin = new Bin(aerospikeSinkConfig.getColumnName(), Value.getAsBlob(keyValue.getValue()));
    AWriteListener listener = null;
    try {
        listener = queue.take();
    } catch (InterruptedException ex) {
        record.fail();
        return;
    }
    listener.setContext(record);
    client.put(eventLoop, listener, writePolicy, key, bin);
}