revchain

package module
v0.0.0-...-9163617 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const KEK_PATH = "k/"

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	PrevHash  string      `json:"prev_hash"`
	Index     int         `json:"index"`
	Kekspace  interface{} `json:"space"`
	Timestamp int64       `json:"timestamp"`
	Data      BlockData   `json:"data"`
	Hash      string      `json:"hash"`
	Signature Signature   `json:"signature"`
}

func (Block) GenHash

func (block Block) GenHash(b Block) []byte

func (Block) HashString

func (b Block) HashString() string

func (Block) New

func (b Block) New(ks interface{}, addData map[string]interface{}, modifyData map[string]interface{}, deleteData map[string]interface{}, pHash string, index int) Block

func (Block) ValidateHash

func (b Block) ValidateHash() bool

type BlockData

type BlockData struct {
	Add    map[string]interface{} `json:"add"`
	Modify map[string]interface{} `json:"modify"`
	Delete map[string]interface{} `json:"delete"`
}

type Chain

type Chain struct {
	Blocks  []Block `json:"blocks"`
	CurHash string  `json:"current_hash"`
	Index   int     `json:"index"`
	// contains filtered or unexported fields
}

func (Chain) AddBlock

func (t Chain) AddBlock(id string, addData map[string]interface{}, modifyData map[string]interface{}, deleteData map[string]interface{}) (ChainMaker, error)

func (Chain) Delete

func (t Chain) Delete(id string) error

func (Chain) GetBlocks

func (t Chain) GetBlocks() []Block

func (Chain) GetHashString

func (t Chain) GetHashString() string

func (Chain) Load

func (t Chain) Load(id string) (ChainMaker, error)

func (Chain) New

func (t Chain) New(id string, data map[string]interface{}) (ChainMaker, error)

func (Chain) SetStore

func (t Chain) SetStore(store kekstore.Storer) Chain

type ChainMaker

type ChainMaker interface {
	New(itemId string, data map[string]interface{}) (ChainMaker, error)
	GetHashString() string
	AddBlock(itemId string, addData map[string]interface{}, modifyData map[string]interface{}, deleteData map[string]interface{}) (ChainMaker, error)
	Load(path string) (ChainMaker, error)
	Delete(id string) error
	GetBlocks() []Block
}

type Signature

type Signature struct {
	Token  string `json:"token"`
	Source string `json:"string"`
}

Jump to

Keyboard shortcuts

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