← Back to team overview

syncany-team team mailing list archive

Re: Long ids

 

Hi Philipp,

Le 06/12/2013 17:58, Philipp Heckel a écrit :
>> [..]
>> So getChunkInputStream(ChunkEntryId) or getChunkInputStream(byte[]
>> checksum)?
>> 
> 
> This is definitely not the nicest design of Syncany  -- what you can
> also see by the TODO right next to the method.
> 
> I think what's important is to keep dependencies between packages to
> a minimal, or at least only in one direction. In this case, this is 
> particularly relevant, because: ChunkEntry != Chunk --- A ChunkEntry
> is a database representation (id + size) or the actual chunk data,
> while a Chunk is the actual chunk (id + size + data!) produced by the
> Chunker.

The ChunkEntry is only the database representation, right?

> This also explains the seemingly duplicates of classes in the 
> org.syncany.chunk and org.syncany.database packages.
> 
> To answer your question: the latter, for now. :-)

Hum, but if the ChunkEntry and the Chunk both contains the checksum
which is the Id of the Chunk, why do we need a ChunkEntryId is the first
place? Or to put it differently, why not replacing the byte[] in
ChunkEntry and Chunk by a ChunkId?

I'm asking because if you want to keep getChunkInputStream(byte[])
(which totally makes sense), then the ChunkEntryId must leek its
internal representation (as a byte[]). So either it's a getCheckSum
specific to ChunkEntryId, so far so good, or it's a general method of
ObjectId. I would refrain from using the latter solution, because it
will be inefficient for tight memory representation of short ids. Not a
big deal, again. Also if you go for Gregor's solution (or a variant of
it), it would mean putting getByteArray in the ObjectId which again is
not so beautiful.

Anyway, not a big deal...

Cheers,

Fabrice


Follow ups

References