tlog.app/go/tlog@v0.23.1/tlwire/wire.go (about)

     1  package tlwire
     2  
     3  // Major types.
     4  const (
     5  	Int = iota << 5
     6  	Neg
     7  	Bytes
     8  	String
     9  	Array
    10  	Map
    11  	Semantic
    12  	Special
    13  
    14  	TagMask    = 0b111_00000
    15  	TagDetMask = 0b000_11111
    16  )
    17  
    18  // Len.
    19  const (
    20  	Len1 = 24 + iota
    21  	Len2
    22  	Len4
    23  	Len8
    24  	_
    25  	_
    26  	_
    27  	LenBreak = Break
    28  )
    29  
    30  // Specials.
    31  const (
    32  	False = 20 + iota
    33  	True
    34  	Nil
    35  	Undefined
    36  
    37  	Float8
    38  	Float16
    39  	Float32
    40  	Float64
    41  	_
    42  	_
    43  	_
    44  	Break
    45  
    46  	None    = 19 // used to preserve padding
    47  	Hidden  = 18 // passwords, etc. when you want to preserve the key
    48  	SelfRef = 17 // self reference
    49  )
    50  
    51  // Semantics.
    52  const (
    53  	Meta = iota
    54  	Error
    55  	Time
    56  	Duration
    57  	Big
    58  
    59  	Caller
    60  	_
    61  	Hex
    62  	_
    63  	Embedding
    64  
    65  	SemanticTlogBase = 10
    66  )
    67  
    68  // Meta.
    69  const (
    70  	MetaMagic = iota
    71  	MetaVer
    72  
    73  	MetaTlogBase = 8
    74  )
    75  
    76  const Magic = "\xc0\x64tlog"
    77  
    78  func init() {
    79  	if Break != TagDetMask {
    80  		panic(Break)
    81  	}
    82  
    83  	if Break != LenBreak {
    84  		panic(Break)
    85  	}
    86  }