okatype_version

package
v0.0.0-...-9517573 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package okatype_version (i.e., Okanero type version) provides the okatype_version.Type and okatype_version.NullableType types.

With the Okanero protocol, there is a message-oriented layer to it.

The Okanero protocol calls its messages "datum".

(In Golang, we can think of serialized Okanero datum as a []byte.)

(You could probably safely conflate an Okanero datum with a "block" in a "blockchain".)

For safety and future proofing reasons, there is a mechanism to allow different versions of an Okanero datum.

The second 8 bytes (after the magic) of a Okanero datum is the Okanero datum version.

Those 8 bytes are interpreted as a little-endian 64 bit integer.

This can be understood as:

[8]byte{203,255,0,0,0,0,0,0}

... begin interpreted as:

(203 × 256^0)  +  (255 × 256^1) =

(203 ×   1)    +  (255 × 256)   =

 203           +  65280         =

65513

So, continuing our example, if we include the magic also, the first 16 bytes in that example would be:

[16]byte{
	7,'o','k','a','n','e','r','o' // <-- magic, as a Pascal-string
	203,255,0,0,0,0,0,0,          // <-- version, as a little-endian 64 bit integer.
}

The okatype_version.Type is a way of representing this "version" in a Golang struct. I.e.,

struct Datum {
	Magic   okatype_magic.Type
	Version okatype_version.Type

	// ...
}

MOST LIKELY YOU WOULD NOT CREATE YOUR OWN okatype_version.Type, BUT INSTEAD USE IT FROM AN okatype_datum.Type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullableType

type NullableType struct {
	// contains filtered or unexported fields
}

func NoneNullable

func NoneNullable() NullableType

func Null

func Null() NullableType

func SomeNullable

func SomeNullable(value int64) NullableType

func (NullableType) Int64

func (receiver NullableType) Int64() (int64, error)

func (NullableType) MarshalJSON

func (receiver NullableType) MarshalJSON() ([]byte, error)

func (*NullableType) Scan

func (receiver *NullableType) Scan(src interface{}) error

func (NullableType) String

func (receiver NullableType) String() string

func (*NullableType) UnmarshalJSON

func (receiver *NullableType) UnmarshalJSON(b []byte) error

func (NullableType) Value

func (receiver NullableType) Value() (driver.Value, error)

func (NullableType) WhenNone

func (receiver NullableType) WhenNone(fn func())

func (NullableType) WhenNull

func (receiver NullableType) WhenNull(fn func())

func (NullableType) WhenSome

func (receiver NullableType) WhenSome(fn func(int64))

type Type

type Type struct {
	// contains filtered or unexported fields
}

func None

func None() Type

func Some

func Some(value int64) Type

func (Type) Int64

func (receiver Type) Int64() (int64, error)

func (Type) MarshalJSON

func (receiver Type) MarshalJSON() ([]byte, error)

func (*Type) Scan

func (receiver *Type) Scan(src interface{}) error

func (Type) String

func (receiver Type) String() string

func (*Type) UnmarshalJSON

func (receiver *Type) UnmarshalJSON(b []byte) error

func (Type) Value

func (receiver Type) Value() (driver.Value, error)

func (Type) WhenNone

func (receiver Type) WhenNone(fn func())

func (Type) WhenSome

func (receiver Type) WhenSome(fn func(int64))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL