Examples of flattenToBuffer()


Examples of org.voltcore.messaging.VoltMessage.flattenToBuffer()

        VoltDbMessageFactory vdbmf = new VoltDbMessageFactory();

        VoltMessage msg2 = vdbmf.createMessageFromBuffer(buf1, -1);
        ByteBuffer buf2 = ByteBuffer.allocate(msg2.getSerializedSize());
        msg2.flattenToBuffer(buf2);
        buf1.rewind();
        buf2.rewind();

        assertEquals(buf1.remaining(), buf2.remaining());
        assertTrue(buf1.compareTo(buf2) == 0);
View Full Code Here

Examples of org.voltdb.ClientResponseImpl.flattenToBuffer()

                        response = new ClientResponseImpl(ClientResponseImpl.SUCCESS, vt,
                                "Extra String", spi.getClientHandle());
                    }
                    ByteBuffer buf = ByteBuffer.allocate(4 + response.getSerializedSize());
                    buf.putInt(buf.capacity() - 4);
                    response.flattenToBuffer(buf);
                    buf.clear();
                    c.writeStream().enqueue(buf);
                    roundTrips.incrementAndGet();
                    System.err.println("Sending response.");
                }
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

    public void setEmptyForRestart(int outputDepId) {
        m_emptyForRestart = true;
        ParameterSet blank = ParameterSet.emptyParameterSet();
        ByteBuffer mt = ByteBuffer.allocate(blank.getSerializedSize());
        try {
            blank.flattenToBuffer(mt);
        }
        catch (IOException ioe) {
            // Shouldn't ever happen, just bail out to not-obviously equivalent behavior
            mt = ByteBuffer.allocate(2);
            mt.putShort((short)0);
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

        ByteBuffer param1_buf = ByteBuffer.allocate(param_set1.getSerializedSize());
        param_set1.flattenToBuffer(param1_buf);
        param1_buf.flip();

        ByteBuffer param2_buf = ByteBuffer.allocate(param_set2.getSerializedSize());
        param_set2.flattenToBuffer(param2_buf);
        param2_buf.flip();

        FragmentTaskMessage ft = new FragmentTaskMessage(9, 70654312, -75, 99, true, true, false);
        ft.addFragment(new byte[20], 12, param1_buf);
        ft.addFragment(new byte[20], 24, param2_buf);
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

    ByteBuffer createDummyParameterSet() throws IOException
    {
        ParameterSet blah = ParameterSet.fromArrayNoCopy(new Long(4321), new Long(5678));
        ByteBuffer params = ByteBuffer.allocate(blah.getSerializedSize());
        blah.flattenToBuffer(params);
        params.flip();
        return params;
    }

    // Currently emulates the code in ProcedureRunner.slowPath()
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

        for (AdHocPlannedStatement cs : plannedStatements) {
            size += cs.getSerializedSize();
        }

        ByteBuffer buf = ByteBuffer.allocate(size);
        userParamCache.flattenToBuffer(buf);
        buf.putShort((short) plannedStatements.size());
        for (AdHocPlannedStatement cs : plannedStatements) {
            cs.flattenToBuffer(buf);
        }
        return buf;
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

                    fser.write((ByteBuffer) parameterSets[i]);
                }
                else {
                    ParameterSet pset = (ParameterSet) parameterSets[i];
                    ByteBuffer buf = ByteBuffer.allocate(pset.getSerializedSize());
                    pset.flattenToBuffer(buf);
                    buf.flip();
                    fser.write(buf);
                }
            }
        } catch (final IOException exception) {
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

        m_data.putInt(Commands.Hashinate.m_id);
        m_data.putInt(config.type.typeId());
        m_data.putInt(config.configBytes.length);
        m_data.put(config.configBytes);
        try {
            parameterSet.flattenToBuffer(m_data);

            m_data.flip();
            m_connection.write();

            m_connection.readStatusByte();
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

                psetBuffer.put(buf);
            }
            else {
                ParameterSet pset = (ParameterSet) parameterSets[i];
                try {
                    pset.flattenToBuffer(psetBuffer);
                }
                catch (final IOException exception) {
                    throw new RuntimeException("Error serializing parameters for SQL batch element: " +
                                               i + " with plan fragment ID: " + planFragmentIds[i] +
                                               " and with params: " +
View Full Code Here

Examples of org.voltdb.ParameterSet.flattenToBuffer()

        ParameterSet parameterSet = ParameterSet.fromArrayNoCopy(value, config.type.typeId(), config.configBytes);

        // serialize the param set
        clearPsetAndEnsureCapacity(parameterSet.getSerializedSize());
        try {
            parameterSet.flattenToBuffer(psetBuffer);
        } catch (final IOException exception) {
            throw new RuntimeException(exception); // can't happen
        }

        return nativeHashinate(pointer, config.configPtr, config.numTokens);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.