Skip to content

Bloklinx Schema (flatbuffers)

Matt Pouttu-Clarke edited this page Jun 24, 2016 · 11 revisions

The Bloklinx schema adds a "Bloklinx" struct definition and BLOP enum to any flatbuffer schema with the following fields:

enum BLOP : byte { NOOP = 0, Assert = 1, Redact = -1, PutRedact = -2, PutAssert = 2 }
struct Bloklinx {
  etag:[byte];       
  delta:long;        
  sid:[byte];        
  op:BLOP = NOOP;    
  provenance:[byte]; 
}

It doesn't matter what the Bloklinx field is named when you place it in your object, but you should only place one Bloklinx struct instance at the root type level. Notice there is no timestamp in the meta data. This is intentional as the use of user timestamps in distributed versioning cause tremendous issues. Feel free to put your own timestamp in your objects and Bloklinx will treat them just like any other field.

Operation codes

NOOP

Allows smoke test of system without any Bloklinx logic. Any NOOP is ignored (and filtered) by Bloklinx but may be useful for debugging if the other components of the system are working.

Assert

Equivalent to "INSERT" operation in relational database land. Assertion of new data into the system.

  • etag = (hash of non-Bloklinx data items and sid)
  • delta = 0
  • sid = (session identifier, could be Kerb token or openid or other)
  • provenance = etag

Redact

Equivalent to a logical "DELETE" operation in relational database land. Redaction of data. Note that the exact record content of the previous delta must be present in the object in order for Bloklinx to accept a redaction. Population of what the user considers the "key" fields without populating all the other fields results in a failed redaction.

  • etag = (previous etag of redacted data)
  • delta = (previous delta)++
  • sid = (session identifier, could be Kerb token or openid or other)
  • provenance = (previous provinance)

PutRedact

When followed immediately by PutAssert, is equivalent to a logical "UPDATE" operation in relational database land. PutRedact of data must be followed by PutAssert of new data with the same provenance. Note that the exact record content of the previous delta must be present in the PutRedact object in order for Bloklinx to accept a redaction. Population of what the user considers the "key" fields without populating all the other fields results in a failed redaction, and also fails the following PutAssert operation as well if any.

  • etag = (previous etag of redacted data)
  • delta = (previous delta)++
  • sid = (session identifier, could be Kerb token or openid or other)
  • provenance = (previous provinance)

PutAssert

When preceded immediately by PutRedact, is equivalent to a logical "UPDATE" operation in relational database land. PutRedact of data must be followed by PutAssert of new data with the same provenance. The delta and provenance of the paired PutRedact and PutAssert records must be identical.

  • etag = (hash of non-Bloklinx data items and sid)
  • delta = (delta of preceding PutRedact)++
  • sid = (session identifier, could be Kerb token or openid or other)
  • provenance = (previous provinance)