Package com.foundationdb.ais.protobuf

Examples of com.foundationdb.ais.protobuf.ProtobufWriter


        clone(newAIS, ais, selector);
        return newAIS;
    }

    public void clone(AkibanInformationSchema destAIS, AkibanInformationSchema srcAIS, ProtobufWriter.WriteSelector selector) {
        ProtobufWriter writer = new ProtobufWriter(selector);
        AISProtobuf.AkibanInformationSchema pbAIS = writer.save(srcAIS);
        ProtobufReader reader = new ProtobufReader(typesRegistry, storageFormatRegistry, destAIS, pbAIS.toBuilder());
        reader.loadAIS();
    }
View Full Code Here


        return PathUtil.extend(ONLINE_PATH, Long.toString(onlineID));
    }

    /** Serialize given AIS. Allocates a new buffer if necessary so always use <i>returned</i> buffer. */
    private static ByteBuffer serialize(ByteBuffer buffer, AkibanInformationSchema ais, ProtobufWriter.WriteSelector selector) {
        ProtobufWriter writer = new ProtobufWriter(selector);
        writer.save(ais);
        int size = writer.getBufferSize();
        if(buffer == null || (buffer.capacity() < size)) {
            buffer = ByteBuffer.allocate(size);
        }
        buffer.clear();
        writer.serialize(buffer);
        buffer.flip();
        return buffer;
    }
View Full Code Here

        assertEquals(expectedAIS, ais);
    }

    private ByteBuffer serialize(AkibanInformationSchema ais) throws Exception
    {
        ProtobufWriter writer = new ProtobufWriter();
        writer.save(ais);
        ByteBuffer buffer = ByteBuffer.allocate(writer.getBufferSize());
        writer.serialize(buffer);
        buffer.flip();
        return buffer;
    }
View Full Code Here

        }
    }

    /** Serialize given AIS. Allocates a new buffer if necessary so always use <i>returned</i> buffer. */
    private static ByteBuffer serialize(ByteBuffer buffer, AkibanInformationSchema ais, WriteSelector selector) {
        ProtobufWriter writer = new ProtobufWriter(selector);
        writer.save(ais);
        int size = writer.getBufferSize();
        if(buffer == null || (buffer.capacity() < size)) {
            buffer = ByteBuffer.allocate(size);
        }
        buffer.clear();
        writer.serialize(buffer);
        buffer.flip();
        return buffer;
    }
View Full Code Here

        TestStorageDescriptionExtended storageDescription = new TestStorageDescriptionExtended(sequence, identifier);
        storageDescription.setStorageKey("KEY");
        storageDescription.setExtension("PLUS");
        assertTrue(isFullDescription(storageDescription));
        sequence.setStorageDescription(storageDescription);
        ProtobufWriter writer = new ProtobufWriter();
        writer.save(aisb.akibanInformationSchema());
        writer.serialize(bytes);
        bytes.flip();
    }
View Full Code Here

        AkibanInformationSchema ais = new AkibanInformationSchema();
        ProtobufReader reader = new ProtobufReader(typesRegistry, newFormatRegistry, ais);
        reader.loadBuffer(bytes);
        reader.loadAIS();
        bytes.flip();
        ProtobufWriter writer = new ProtobufWriter();
        writer.save(ais);
        writer.serialize(bytes);
        bytes.flip();
        Sequence sequence = loadSequence(typesRegistry, testFormatRegistry);
        assertNotNull(sequence);
        assertTrue(isFullDescription(sequence.getStorageDescription()));
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.protobuf.ProtobufWriter

Copyright © 2018 www.massapicom. 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.