Mariano Martinez Peck wrote:
On Fri, Feb 10, 2012 at 7:01 AM, Yanni Chiu <yanni@rogers.com> wrote:
On 09/02/12 10:20 PM, Martin Dias wrote:
Hi! We don't have unused fields, but there is no problem to add your own prefix: [...]
Is this ok for you?
It'll do the job. Here's what the file would have:
yanni$ od -c demoMetadata.fuel 0000000 \n m e t a d a t a = 5 F U E L \0 0000020 021 017 F L U I n t 1 6 C l u s t e 0000040 r \0 \0 \0 001 \0 \0 \0 001 \0 \0 \0 \0 023 F L 0000060 B y t e S t r i n g C l u s t e 0000100 r \0 \0 \0 001 005 s t u f f \0 001 0000115
It's strange that there is a '\n' at the start. [Okay, figured it out, it's the character count.]
Having "FUEL" and version number appear some where other than the start of file doesn't feel right. And, for sure, FLMaterializer will not just read the file, without some prior code to position the stream past the metadata - i.e. the file is no longer in "standard" Fuel format.
Would Fuel have a problem with extra bytes at the end?
No. Fuel doesn't care. If you consider Fuel "the technology" you may be right. All you need to do is to send it a stream. If the stream is already at a certain position, it doesn't matter it will start from that position. Say you have stream where you write something first and then you give it to Fuel to serialize. The stream would be at some position different than zero. Say, at position 10. Fuel will start serializing for there. Say we have written 40 bytes. Then, at materialization, when you give it the stream, you have to be sure to give the stream starting at the position 10. However if you consider Fuel "the standard file format" - this would appear to be broken by people using random offsets. Fuel will load EXACTLY 40 bytes and will stop. The stream can continue....fuel doesn't care and it will store exactly when it finishes reading his own bytes.
BTW, this is how some databases work. The save several serialized objects in the same stream...
To reach for the moon... Perhaps Fuel "the standard file format" holding multiple streams might be formalized by tagging different each stream with a 'name' and/or a 'type' and/or 'deserializerMethod'. The first two of these might be '#fuel -> #fuelDeserializer' and '#meta->#textDeserializer'. The the default Fuel system can then automatically ignore 3rd-party data.
Cheers