github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/logbook/oplog/log.fbs (about) 1 // IDL file for log service 2 namespace logfb; 3 4 // setting file_identifier adds a "magic number" to bytes 4-7 to use as a 5 // sanity check for a "Qri FlatBuffer File". As our use of flatbuffers grows 6 // this file identifier should remain as the top level identifier for all 7 // qri flatbuffer schemas 8 file_identifier "QFBF"; 9 10 // for our use this is mainly an annotation. this file extension for a 11 // "qri flatbuffer" file should be .qfb 12 file_extension "qfb"; 13 14 // OpType enumerates types of operations 15 enum OpType: byte { Unknown = 0, Init, Amend, Remove } 16 17 // flatbuffers in go presently don't support a vector of unions, so we can't 18 // break operations out into individual structs & union them, which would be 19 // the smart choice here. To get around this, the fields of operation itself 20 // are a union of all fields defined by operations. Thankfully there's a fair 21 // amount of overlap, even more if we abuse field names a bit. 22 // Not all operations will use all fields. 23 // 24 // I've opted to use "Operation" and reserve "Op" 25 // as a keyword for the day where we can do a vector of a union type 26 table Operation { 27 type:OpType; // type of operation 28 model:uint; // data model to operate on, designated by 4 bytes 29 ref:string; // identifier of data this operation is documenting 30 prev:string; // previous reference in a causal history 31 relations:[string]; // references this operation relates. usage is operation type-dependant 32 33 name:string; // human-readable name for the reference 34 authorID:string; // identifier for author 35 36 timestamp:long; // operation timestamp, for annotation purposes only 37 size:long; // size of the referenced value in bytes 38 note:string; // operation annotation for users. eg: commit title 39 } 40 41 // Log is a list of operations 42 table Log { 43 name:string; // human component of a log label, cached from opset 44 identifier:string; // canonical component of a log label, cached from opset 45 signature:string; // cryptographic signature of opset hash 46 opset:[Operation]; // append-only list of operations being logged 47 logs:[Log]; // logs can be arranged into hierarchies 48 } 49 50 // Book is an author's journal of logs 51 table Book { 52 name:string; // book author name, not in use at the moment 53 identifier:string; // book author identifier 54 logs:[Log]; // collection of logsets in this book 55 } 56 57 root_type Book;