cs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cs defines types to work with Chainscripts.

Index

Constants

View Source
const (
	// CompleteEvidence characterizes a Complete Evidence.
	CompleteEvidence = "COMPLETE"

	// PendingEvidence characterizes a Pending Evidence.
	PendingEvidence = "PENDING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Link struct {
	State map[string]interface{} `json:"state"`
	Meta  map[string]interface{} `json:"meta"`
}

Link contains a state and meta data about the state.

func (*Link) GetMapID

func (l *Link) GetMapID() string

GetMapID returns the map ID as a string. It assumes the link is valid.

func (*Link) GetPrevLinkHash

func (l *Link) GetPrevLinkHash() *types.Bytes32

GetPrevLinkHash returns the previous link hash as a bytes. It assumes the link is valid. It will return nilif the previous link hash is null.

func (*Link) GetPrevLinkHashString

func (l *Link) GetPrevLinkHashString() string

GetPrevLinkHashString returns the previous link hash as a string. It assumes the link is valid. It will return an empty string if the previous link hash is null.

func (*Link) GetPriority

func (l *Link) GetPriority() float64

GetPriority returns the priority as a float64 It assumes the link is valid. If priority is nil, it will return -Infinity.

func (*Link) GetProcess

func (l *Link) GetProcess() string

GetProcess returns the process name as a string. It assumes the link is valid.

func (*Link) GetTagMap

func (l *Link) GetTagMap() map[string]struct{}

GetTagMap returns the tags as a map of string to empty structs (a set). It assumes the link is valid.

func (*Link) GetTags

func (l *Link) GetTags() []string

GetTags returns the tags as an array of string. It assumes the link is valid. It will return nil if there are no tags.

type Segment

type Segment struct {
	Link Link                   `json:"link"`
	Meta map[string]interface{} `json:"meta"`
}

Segment contains a link and meta data about the link.

func (*Segment) GetEvidence

func (s *Segment) GetEvidence() map[string]interface{}

GetEvidence returns the segment evidence

func (*Segment) GetLinkHash

func (s *Segment) GetLinkHash() *types.Bytes32

GetLinkHash returns the link ID as bytes. It assumes the segment is valid.

func (*Segment) GetLinkHashString

func (s *Segment) GetLinkHashString() string

GetLinkHashString returns the link ID as a string. It assumes the segment is valid.

func (*Segment) IsEmpty

func (s *Segment) IsEmpty() bool

IsEmpty checks if a segment is empty (nil)

func (*Segment) SetEvidence

func (s *Segment) SetEvidence(evidence map[string]interface{})

SetEvidence sets the segment evidence

func (*Segment) Validate

func (s *Segment) Validate() error

Validate checks for errors in a segment.

type SegmentSlice

type SegmentSlice []*Segment

SegmentSlice is a slice of segment pointers.

func (SegmentSlice) Len

func (s SegmentSlice) Len() int

Len implements sort.Interface.Len.

func (SegmentSlice) Less

func (s SegmentSlice) Less(i, j int) bool

Less implements sort.Interface.Less.

func (SegmentSlice) Swap

func (s SegmentSlice) Swap(i, j int)

Swap implements sort.Interface.Swap.

Directories

Path Synopsis
Package cstesting defines helpers to test Chainscripts.
Package cstesting defines helpers to test Chainscripts.

Jump to

Keyboard shortcuts

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