texajson

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 13 Imported by: 1

README

texajson

CodeFactor

JSON package for handling JSON-based ops in the test instance

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Cat  = "Cat"
	Mts  = "Mts"
	Slab = "Slab"
)
View Source
var RedisClient *redis.Client
View Source
var SlabTempNQD []int
View Source
var SlabTempSize []int

Functions

func CatToJson

func CatToJson(p interface{}) string

CatToJson marshals CatPageArray data into JSON format

func InitCluster added in v0.0.5

func InitCluster(host, port string)

InitCluster ... Initialize ipfs-cluster client

func SlabToJson

func SlabToJson(p interface{}) string

SlabToJson marshals SlabPageArray data into JSON format

func ToJson

func ToJson(p interface{}) string

ToJson marshals PageArray data into JSON format

func WriteDataToIPFS added in v0.0.3

func WriteDataToIPFS(ipfsURL string, data interface{}) string

WriteDataToIPFS is used to write a data to IPFS using ipldcrud and return the CID

Types

type CatPage

type CatPage struct {
	AIName string        `json:"AIName"`
	CatVal []CatValArray `json:"CatVal"`
}

CatPage exports schema for data/cat.json

func AddtoCatPageArray

func AddtoCatPageArray(p CatPage, pa []CatPage) []CatPage

AddtoCatPageArray Appends a new CatPage 'p' to the specified target CatPageArray 'pa'

func ConvtoCatPage

func ConvtoCatPage(AIName string, slabPageArray []SlabPage, SlabNameArray []string) CatPage

ConvtoCatPage converts a set of data vars into a CatPage struct variable

func GetCatPages

func GetCatPages() []CatPage

GetCatPages returns a converted CatPage Array persistent to the mts.json

func (CatPage) ToString

func (p CatPage) ToString() string

ToString returns the string equivalent JSON format of CatPage

type CatValArray

type CatValArray struct {
	CatName     string        `json:"CatName"`
	Spf         float64       `json:"Spf"`
	Interaction []Interaction `json:"Interaction"`
}

CatValArray exports the sub-JSON document for CatPage

type Interaction added in v0.0.5

type Interaction struct {
	HumanTransaction string `json:"HumanTransaction"`
	AiTransaction    string `json:"AiTransaction"`
	QuantumScore     uint64 `json:"QuantumScore"`
	Justification    string `json:"Justification"`
}

Interaction represents communication b/w Ai and human and its quantum score along with Justification.

func (Interaction) ToString added in v0.0.5

func (i Interaction) ToString() string

type Interrogation added in v0.0.3

type Interrogation struct {
	IntName  string        `json:"IntName"`
	ArtiMts  float64       `json:"ArtiMts"`
	HumanMts float64       `json:"HumanMts"`
	CatVal   []CatValArray `json:"CatVal"`
}

Interrogation is used to record the data from a session

func NewInterrogationObject added in v0.0.3

func NewInterrogationObject(IntName string, ArtiMts, HumanMts float64, CatVal []CatValArray) Interrogation

NewInterrogationObject is created a new object and returns it

type IpfsCluster added in v0.0.5

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

IpfsCluster ... Client for IPFS-CLUSTER

func GetInstance added in v0.0.5

func GetInstance() *IpfsCluster

GetInstance ... returns an IPFS cluster client

func (IpfsCluster) PinCid added in v0.0.5

func (c IpfsCluster) PinCid(cid string) (retVal *api.Pin, err error)

PinCid .. Pins a cid into the ipfs-cluster network

type Page

type Page struct {
	AIName   string  `json:"AIName"`
	IntName  string  `json:"IntName"`
	ArtiMts  float64 `json:"ArtiMts"`
	HumanMts float64 `json:"HumanMts"`
}

Page exports schema for mts.json

func AddtoPageArray

func AddtoPageArray(p Page, pa []Page) []Page

AddtoPageArray Appends a new page 'p' to the specified target PageArray 'pa'

func ConvtoPage

func ConvtoPage(AIName string, IntName string, ArtiMts float64, HumanMts float64) Page

ConvtoPage converts a set of data vars into a Page struct variable

func GetPages

func GetPages() []Page

GetPages returns a converted Page Array persistent to the mts.json

func (Page) ToString

func (p Page) ToString() string

ToString returns the string equivalent JSON format of Page

type Result added in v0.0.3

type Result struct {
	AIName         string          `json:"AIName"`
	Interrogations []Interrogation `json:"Interrogations"`
}

Result is the master table recording the results of all test sessions for a given AI

func NewResultObject added in v0.0.3

func NewResultObject(aiName string) Result

NewResultObject is used to create a new Result object for a new AI

type SlabPage

type SlabPage struct {
	SlabName     string        `json:"SlabName"`
	NQDropped    int           `json:"NQDropped"`
	AvgSlabSize  int           `json:"AvgSlabSize"`
	NSlabExposed int           `json:"NSlabExposed"`
	Interactions []Interaction `json:"Interaction"`
}

SlabPage exports schema for reportcard/mts.json

func AddtoSlabPageArray

func AddtoSlabPageArray(p SlabPage, pa []SlabPage) []SlabPage

AddtoSlabPageArray Appends a new Slabpage 'p' to the specified target SlabPageArray 'pa'

func ConvtoSlabPage

func ConvtoSlabPage(ArtiQSA []uint64, SlabNameArray []string, slabSeqArray []string, justifications []string, transactions []string) []SlabPage

ConvtoSlabPage configures the parameters of SlabPage using the ArtiQSA

func GetSlabPages

func GetSlabPages() []SlabPage

GetSlabPages returns a converted SlabPage Array persistent to the mts.json

func (SlabPage) ToString

func (p SlabPage) ToString() string

ToString returns the string equivalent JSON format of SlabPage

Jump to

Keyboard shortcuts

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