Examples of FastBlobSchema


Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

        }

        FlatBlobDeserializationRecord rec = map.get(type);

        if(rec == null) {
            FastBlobSchema schema = framework.getSerializer(type).getFastBlobSchema();
            rec = new FlatBlobDeserializationRecord(schema);
            map.put(type, rec);
        }

        return rec;
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

        this.ordinalMapping = ordinalMapping;
        this.scratch = new ByteDataBuffer();
    }

    public void remapOrdinals(FastBlobDeserializationRecord rec, ByteDataBuffer toBuffer) {
        FastBlobSchema schema = rec.getSchema();
        ByteData fromSpace = rec.getByteData();

        long currentPointerPosition = rec.position();

        for(int i=0;i<schema.numFields();i++) {
            FieldDefinition fieldDef = schema.getFieldDefinition(i);
            int length = rec.getFieldLength(schema.getFieldName(i));

            TypedFieldDefinition typedFieldDef;
            int ordinal;
            int mappedOrdinal;
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

    private FastBlobSchema schema;

    @Before
    public void setUp() {
        schema = new FastBlobSchema("test", 3);

        schema.addField("field1", new FieldDefinition(FieldType.INT));
        schema.addField("field2", new TypedFieldDefinition(FieldType.OBJECT, "Field2"));
        schema.addField("field3", new FieldDefinition(FieldType.FLOAT));
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

    public void serializesAndDeserializes() throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();

        schema.writeTo(new DataOutputStream(os));

        FastBlobSchema deserialized = FastBlobSchema.readFrom(new DataInputStream(new ByteArrayInputStream(os.toByteArray())));

        Assert.assertEquals(3, deserialized.numFields());
        Assert.assertEquals(FieldType.INT, deserialized.getFieldType("field1"));
        Assert.assertEquals(FieldType.OBJECT, deserialized.getFieldType("field2"));
        Assert.assertEquals(FieldType.FLOAT, deserialized.getFieldType("field3"));
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

    }


    @Test
    public void testEquals() throws IOException {
        FastBlobSchema otherSchema = new FastBlobSchema("test", 3);

        otherSchema.addField("field1", new FieldDefinition(FieldType.INT));
        otherSchema.addField("field2", new TypedFieldDefinition(FieldType.OBJECT, "Field2"));
        otherSchema.addField("field3", new FieldDefinition(FieldType.FLOAT));

        Assert.assertTrue(otherSchema.equals(schema));


        FastBlobSchema anotherSchema = new FastBlobSchema("test", 3);

        anotherSchema.addField("field1", new FieldDefinition(FieldType.INT));
        anotherSchema.addField("field2", new TypedFieldDefinition(FieldType.OBJECT, "Field2"));
        anotherSchema.addField("field3", new FieldDefinition(FieldType.INT));

        Assert.assertFalse(anotherSchema.equals(schema));
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

    private void readSnapshotTypes(StreamingByteData byteData, DataInputStream dis, int numTypes) throws IOException {
        for(int i=0;i<numTypes;i++) {
            /// type flags byte -- reserved for later use
            dis.read();

            FastBlobSchema schema = FastBlobSchema.readFrom(dis);

            readTypeStateObjects(byteData, schema);
        }
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

        for(int i=0;i<numTypes;i++) {
            /// type flags byte -- reserved for later use
            dis.read();

            FastBlobSchema schema = FastBlobSchema.readFrom(dis);

            readTypeStateObjectsDoubleSnapshotRefresh(byteData, schema, serializedRepresentationMap);

            serializedRepresentationMap.clear();
        }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

        for(int i=0;i<numTypes;i++) {
            /// type flags byte -- reserved for later use
            dis.read();

            FastBlobSchema schema = FastBlobSchema.readFrom(dis);

            readTypeStateRemovals(byteData, schema);
            readTypeStateObjects(byteData, schema);
        }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

        this.schemaName = schemaName;
    }

    public void serialize(T value, NFSerializationRecord rec) {
        /// automatically track the schemas.
        FastBlobSchema existingSchema = rec.getSchema();
        rec.setSchema(getFastBlobSchema());
        doSerialize(value, rec);
        rec.setSchema(existingSchema);
    }
View Full Code Here

Examples of com.netflix.zeno.fastblob.record.schema.FastBlobSchema

        field.type = new MapFieldDefinition(keyType, valueType);
        return field;
    }

    protected FastBlobSchema schema(FastBlobSchemaField... fields) {
        FastBlobSchema schema = new FastBlobSchema(schemaName, fields.length);
        for(FastBlobSchemaField field : fields) {
            schema.addField(field.name, field.type);
        }
        return schema;
    }
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.