cmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LINK_PROTO_VERSION = 1
)

Variables

View Source
var (
	DagEthCodecs map[string]uint64 = make(map[string]uint64)
)

eth-block ipld 0x90 permanent Ethereum Header (RLP) eth-block-list ipld 0x91 permanent Ethereum Header List (RLP) eth-tx-trie ipld 0x92 permanent Ethereum Transaction Trie (Eth-Trie) eth-tx ipld 0x93 permanent Ethereum Transaction (MarshalBinary) eth-tx-receipt-trie ipld 0x94 permanent Ethereum Transaction Receipt Trie (Eth-Trie) eth-tx-receipt ipld 0x95 permanent Ethereum Transaction Receipt (MarshalBinary) eth-state-trie ipld 0x96 permanent Ethereum State Trie (Eth-Secure-Trie) eth-account-snapshot ipld 0x97 permanent Ethereum Account Snapshot (RLP) eth-storage-trie ipld 0x98 permanent Ethereum Contract Storage Trie (Eth-Secure-Trie) eth-receipt-log-trie ipld 0x99 draft Ethereum Transaction Receipt Log Trie (Eth-Trie) eth-reciept-log ipld 0x9a draft Ethereum Transaction Receipt Log (RLP)

Functions

func CreateCidLink(hash []byte) cidlink.Link

CreateCidLink takes a hash eg ethereum hash and converts it to cid multihash

func DagCborRead added in v0.1.1

func DagCborRead(s Storage) func(*gin.Context)

func DagJsonRead added in v0.1.1

func DagJsonRead(s Storage, exchange graphsync.GraphExchange, pi *peer.AddrInfo) func(*gin.Context)

func Decode added in v0.1.1

func Decode(proto datamodel.NodePrototype, src string) (datamodel.Node, error)

func DecodeCBOR added in v0.1.1

func DecodeCBOR(proto datamodel.NodePrototype, src []byte) (datamodel.Node, error)

func Encode added in v0.1.1

func Encode(n datamodel.Node) (string, error)

func EncodeCBOR added in v0.1.1

func EncodeCBOR(n datamodel.Node) ([]byte, error)

func FromJSON added in v0.1.1

func FromJSON(j string) interface{}

func GetDagCBORLinkPrototype added in v0.1.1

func GetDagCBORLinkPrototype() ipld.LinkPrototype

func GetDagEthereumLinkPrototype added in v0.1.1

func GetDagEthereumLinkPrototype(codec string) ipld.LinkPrototype

func GetDagJOSELinkPrototype added in v0.1.1

func GetDagJOSELinkPrototype() ipld.LinkPrototype

func GetDagJSONLinkPrototype added in v0.1.1

func GetDagJSONLinkPrototype() ipld.LinkPrototype

func GetDataContractEnvironment added in v0.1.1

func GetDataContractEnvironment() *cel.Env

func GetDataContractGlobals added in v0.1.1

func GetDataContractGlobals(jsonArgs, did, payload string) map[string]interface{}

func GetLinkPrototype added in v0.1.1

func GetLinkPrototype() ipld.LinkPrototype

func GetRawLinkPrototype added in v0.1.1

func GetRawLinkPrototype() ipld.LinkPrototype

func MockGetDataContract added in v0.1.1

func MockGetDataContract() string

func MockSetOutputSignature added in v0.1.1

func MockSetOutputSignature() bool

func NewAgent

func NewAgent(ctx context.Context, gsynchost host.Host, router string) gsync.GraphExchange

func NewEdge

func NewEdge(ctx context.Context, gsynchost host.Host, router string) string

func NewRouter

func NewRouter(ctx context.Context, gsynchost host.Host, lsys linking.LinkSystem, peerhost string) (gsync.GraphExchange, *peer.AddrInfo)

func NewSchemaFrom added in v0.1.1

func NewSchemaFrom(schemaBytes []byte) (*graphql.Schema, error)
func ParseCidLink(hash string) (cidlink.Link, error)

ParseCidLink parses a string cid multihash into a cidLink

func QueryGraphQL added in v0.1.1

func QueryGraphQL(s Storage) func(*gin.Context)

func ReadFromStore added in v0.1.1

func ReadFromStore(s Storage, hash string, path string) (string, error)

func ValueToJSON added in v0.1.1

func ValueToJSON(val ref.Val) string

From: https://github.com/google/cel-go/blob/master/codelab/solution/codelab.go valueToJSON converts the CEL type to a protobuf JSON representation and marshals the result to a string.

Types

type DagCompute added in v0.1.1

type DagCompute struct {
	// dagContract string
	Storage Storage
}

func (DagCompute) ExecuteDataContractTransaction added in v0.1.1

func (d DagCompute) ExecuteDataContractTransaction(jsonSchemaCid string, inputPayload string, jsonArgs string, did string, contractAddress string, contractId string) (datamodel.Link, error)

func (DagCompute) ReadFromStore added in v0.1.1

func (d DagCompute) ReadFromStore(hash string, path string) (string, error)

type Storage added in v0.1.1

type Storage struct {
	DataStore  fsstore.Store
	LinkSystem linking.LinkSystem
}

func NewStorage added in v0.1.1

func NewStorage(folder string) Storage

func (*Storage) Load added in v0.1.1

func (k *Storage) Load(linkCtx ipld.LinkContext, link datamodel.Link) (datamodel.Node, error)

Load node from dag-json

func (*Storage) Store added in v0.1.1

func (k *Storage) Store(linkCtx ipld.LinkContext, node datamodel.Node) datamodel.Link

Store node as dag-json

func (*Storage) StoreDagCBOR added in v0.1.1

func (k *Storage) StoreDagCBOR(linkCtx ipld.LinkContext, node datamodel.Node) datamodel.Link

Store node as dag-cbor

func (*Storage) StoreDagEth added in v0.1.1

func (k *Storage) StoreDagEth(linkCtx ipld.LinkContext, node datamodel.Node, codecFormat string) datamodel.Link

Store node as dag-eth

func (*Storage) StoreRaw added in v0.1.1

func (k *Storage) StoreRaw(linkCtx ipld.LinkContext, node datamodel.Node) datamodel.Link

Store node as raw

Jump to

Keyboard shortcuts

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