@Override protected void writeRecord(final ProvenanceEventRecord event, final long eventId, final DataOutputStream out) throws IOException { final Record eventRecord = createRecord(event, eventId); schemaRecordWriter.writeRecord(eventRecord, out); }
@Override protected void writeRecord(final ProvenanceEventRecord event, final long eventId, final DataOutputStream out) throws IOException { try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(256)) { final Record eventRecord = createRecord(event, eventId); recordWriter.writeRecord(eventRecord, baos); out.writeInt(baos.size()); baos.writeTo(out); } } }
@Override protected synchronized void writeHeader(final long firstEventId, final DataOutputStream out) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); eventSchema.writeTo(baos); out.writeInt(baos.size()); baos.writeTo(out); baos.reset(); headerSchema.writeTo(baos); out.writeInt(baos.size()); baos.writeTo(out); this.firstEventId = firstEventId; this.systemTimeOffset = System.currentTimeMillis(); final Map<String, Object> headerValues = new HashMap<>(); headerValues.put(EventIdFirstHeaderSchema.FieldNames.FIRST_EVENT_ID, firstEventId); headerValues.put(EventIdFirstHeaderSchema.FieldNames.TIMESTAMP_OFFSET, systemTimeOffset); headerValues.put(EventIdFirstHeaderSchema.FieldNames.COMPONENT_IDS, idLookup.getComponentIdentifiers()); headerValues.put(EventIdFirstHeaderSchema.FieldNames.COMPONENT_TYPES, idLookup.getComponentTypes()); headerValues.put(EventIdFirstHeaderSchema.FieldNames.QUEUE_IDS, idLookup.getQueueIdentifiers()); headerValues.put(EventIdFirstHeaderSchema.FieldNames.EVENT_TYPES, eventTypeNames); final FieldMapRecord headerInfo = new FieldMapRecord(headerSchema, headerValues); schemaRecordWriter.writeRecord(headerInfo, out); }
protected void serializeRecord(final RepositoryRecord record, final DataOutputStream out, RecordSchema schema, RecordSchema repositoryRecordSchema) throws IOException { final RepositoryRecordFieldMap fieldMap = new RepositoryRecordFieldMap(record, schema, contentClaimSchema); final RepositoryRecordUpdate update = new RepositoryRecordUpdate(fieldMap, repositoryRecordSchema); new SchemaRecordWriter().writeRecord(update, out); }
writer.writeRecord(swapFileRecord, out); out.flush();
protected void serializeRecord(final RepositoryRecord record, final DataOutputStream out, RecordSchema schema, RecordSchema repositoryRecordSchema) throws IOException { final RepositoryRecordFieldMap fieldMap = new RepositoryRecordFieldMap(record, schema, contentClaimSchema); final RepositoryRecordUpdate update = new RepositoryRecordUpdate(fieldMap, repositoryRecordSchema); new SchemaRecordWriter().writeRecord(update, out); }