knod

package module
v0.0.0-...-56cc16c Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 11 Imported by: 1

README

knod

hash graph distributed item format

Documentation

Index

Constants

View Source
const (
	UNINITIALIZED int = 0 // Lodge status
	UNPREPARED    int = 1
	AVAILABLE     int = 2
	LOADING       int = 3
	STANDBY       int = 4

	KFREE byte = 0
	LABEL byte = 1
	INTRO byte = 2
	PRIVT byte = 3
	TEMPO byte = 4
	DFOLD byte = 5
	NMACC byte = 6
	ITEXT byte = 7
	REFER byte = 8
	KROOT byte = 251
	BDURL byte = 252
	BODYN byte = 253
	BODY0 byte = 254
	KBNCE byte = 255

	HASH     = 1
	HASHSIGN = 2
	SIGN     = 3
	VERIFY   = 4
)

Variables

This section is empty.

Functions

func Dupstore

func Dupstore(s *Base, d *Base)

func Format

func Format()

func Hash2block

func Hash2block(h *Hash, i int, l uint64) (uint64, error)

func MintLabel

func MintLabel(s string) (Knod, Body)

func MintPrincipal

func MintPrincipal(pub, priv []byte) (Knod, Knod, Body, Knod, Body)

func Op2string

func Op2string(o byte) string

func Place

func Place()

func Readin

func Readin()

func Readone

func Readone()

func Retrieve

func Retrieve()

func Validate

func Validate()

func Writeone

func Writeone()

func Writeout

func Writeout()

Types

type Base

type Base struct {
	Status    int
	Store     *os.File
	Limit     uint64
	Fqdn      string
	Subn      string
	StoreName string
}

func NewStore

func NewStore(fn string, size int64) (b *Base, e error)

func (*Base) Get0

func (b *Base) Get0(h *Hash) (k *Knod, found bool)

func (*Base) Init

func (b *Base) Init(fn string, reinit bool) (br *Base, e error)

func (*Base) LoadPreULs

func (b *Base) LoadPreULs() (e error)

func (Base) ReadBodyBlock

func (b Base) ReadBodyBlock(i uint64) (*Body, error)

func (Base) ReadKnodBlock

func (b Base) ReadKnodBlock(i uint64) (*Knod, error)

func (*Base) SetLocalTemporacle

func (b *Base) SetLocalTemporacle() (e error)

func (*Base) SetWorld

func (b *Base) SetWorld() (e error)

func (Base) WriteBodyBlock

func (b Base) WriteBodyBlock(kb *Body, i uint64) (e error)

func (Base) WriteKnodBlock

func (b Base) WriteKnodBlock(k *Knod, i uint64) (e error)

type Body

type Body struct {
	Mode byte  // 0 = lookup empty and terminal, 252 = url to content, 253 = text continued, 254 = text start, 255 = lookup empty but bounce
	Len  Btlen // text length remaining including this
	Text Btext // utf8
}

func ZeroBody

func ZeroBody() Body

func (Body) Archive

func (b Body) Archive() string

type Btext

type Btext [252]byte

type Btlen

type Btlen [3]byte

type Cksm

type Cksm uint32 // checksum of checksums of nodes held by this node or

type Hash

type Hash [28]byte

func (Hash) Archive

func (h Hash) Archive() string

type Kdate

type Kdate [5]byte

func (Kdate) String

func (k Kdate) String() string

type Kndx

type Kndx [6]byte // index of a Knod in block device of Knods

type Knod

type Knod struct {
	Op   byte // op except 0 = hash slot free, 255 = hash slot available due to allocation bounce on content size
	Subl byte // index within reference (low)
	Subh byte // index within reference (high)
	Date Kdate
	Hk   Hash
	Hr   Hash
	Ttag Kndx
	Pchk Cksm // checksum of Rchk of nodes held... if two lodges differ on this, synchronization is indicated
	Ptag Kndx
	Tp   Slst
	Itag Kndx // index to a well-known universal label for un-tracked tagging, expanded to hash on transmission or zero, also may be used as salt
	Rchk Cksm // checksum of Pchk of nodes held... if two lodges differ on this, synchronization is indicated
	Rtag Kndx
	Tr   Slst
	S    Sign
}

func MintCategory

func MintCategory(p Knod, s string) (c Knod)

func MintDay

func MintDay(l Knod) (d Knod)

func MintWorld

func MintWorld(p Knod) Knod

func ZeroKnod

func ZeroKnod() Knod

func (Knod) Archive

func (k Knod) Archive() string

func (*Knod) HashSignVerify

func (k *Knod) HashSignVerify(svo int, ks, kp, kt *Knod, b, bs, bv *Body) (ok bool)

hash, sign, or verify the concatenated binary value of the op, date, tag hash, parent hash, ref hash, text content.

func (Knod) UnixTime

func (k Knod) UnixTime() time.Time

type Lodge

type Lodge interface {
	Init(a, b string) error
	Prepare() error
}

type Sign

type Sign [64]byte

func (Sign) Archive

func (s Sign) Archive() string

type Slst

type Slst [48]byte

Jump to

Keyboard shortcuts

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