Research and Development 1/^Archief/2009-2010/14/Deltacodering

Uit Werkplaats
Ga naar: navigatie, zoeken

Standaardtypes

Dit zijn de standaarttypes die voor het coderen van delta's gebruikt worden.

Wiretypes

  • WIRETYPE_VARINT = 0
  • WIRETYPE_LENGTH_DELIMITED = 2

tag

arguments: int fieldnumber, int wiretype

  • varint32 ( (fieldnumber << 3) | wiretype)

message

arguments: int fieldnumber, object

string

arguments: int fieldnumber, string value

int32

arguments: int fieldnumber, int value

  • tag(fieldnumber, WIRETYPE_VARINT)
  • value >= 0?
    • varint32 value
  • else
    • varint64 value

int64

arguments: int fieldnumber, long value

bool

arguments: int fieldnumber, bool value

  • tag(fieldnumber, WIRETYPE_VARINT)
  • rawbyte value ? 1 : 0;

bytes

arguments: int fieldnumber, byte[] value

  • varint32 size
  • rawbyte[] value

enum

arguments: int fieldnumber, int value

  • varint value

varint32/64

arguments: int/long value

  • 1bit moreDataFollowing
  • 7bit data

...

  • 1bit moreDataFollowing = 0
  • 7bit data

Messages

Dit zijn de door FedOne geïmplementeerde messages

appliedDelta

  1. message signedOriginalDelta
  2. message hashedVersion
  3. int32 operationsApplied
  4. int64 timestamp

signedDelta

  1. bytes delta
  2. message[] protocolSignature

protocolSignature

  1. bytes signatureBytes
  2. bytes signerId
  3. enum signatureAlgorithm //alleen SHA1_RSA = 1

delta

  1. message hashedVersion
  2. string author
  3. message[] operation
  4. string[] address

hashedVersion

  1. int64 version
  2. bytes historyHash

operation

  1. string addParticipant
  2. string removeParticipant
  3. message mutateDocument
  4. bool noOp

mutateDocument

  1. string documentId
  2. message documentOperation

documentOperation

  1. message[] component

component

  1. message annotationBoundary
  2. string characters
  3. message elementStart;
  4. bool elementEnd
  5. int32 retainItemCount
  6. string deleteCharacters
  7. message elementStart deleteElementStart
  8. bool deleteElementEnd
  9. message replaceAttributes
  10. message updateAttributes

annotationBoundary

  1. bool empty
  2. string[] element
  3. message[] keyValueUpdate changeList

elementStart

  1. string type
  2. message[] keyvaluepair attributes

replaceAttributes

  1. bool empty
  2. message[] keyvaluepair oldAttributes
  3. message[] keyvaluepair newAttributes

updateAttributes

  1. bool empty
  2. message[] keyValueUpdate attributeUpdates

keyValueUpdate

  1. string key
  2. string oldValue
  3. string newValue

keyValuePair

  1. string key
  2. string value