valid

package
v0.0.0-...-ebac000 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Code_OK     = 0
	Code_Failed = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLayer

type AppLayer struct {
	types.Application
	Sh         *shell.Shell
	Validators []Validator
	Evs        EventChan
}

The Application layer that filters passed transactions for validity. Transactions are formatted as:

tx := []byte(  IpfsHash + "/" + EncryptionPassword  )

Upon validation, the layer pulls the vidshare-object from IPFS, and validates it (including the decryption password). Aside from existence and parse-validity, the metadata passes through an array of validators (.Validators-field) which can decide, whether a media object is Valid or not.

Finally, if passed, it (optionally) sends the ipfs-hash, metadata and password through an event channel so that another thread (or agent) can perform further processing asynchronously.

There is one potential source of Non-Determinism: It uses IPFS.

func (*AppLayer) CheckTx

func (a *AppLayer) CheckTx(tx []byte) types.ResponseCheckTx

func (*AppLayer) DeliverTx

func (a *AppLayer) DeliverTx(tx []byte) types.ResponseDeliverTx

type Event

type Event struct {
	Meta *vidshare.MediaMeta
	Ciph *vidshare.Crypto
	Id   string
	Pwd  string

	Phantom bool // True, if this event does not exist (eg. CheckTx)
}

type EventChan

type EventChan chan Event

func (EventChan) Issue

func (ec EventChan) Issue(ev Event)

type Validator

type Validator func(mmd *vidshare.MediaMeta) bool

Jump to

Keyboard shortcuts

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