sdk

package module
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 35 Imported by: 7

README

sdk

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 Eth ereum 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 Decode

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

func DecodeCBOR

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

func Encode

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

func EncodeCBOR

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

func GetDagCBORLinkPrototype

func GetDagCBORLinkPrototype() ipld.LinkPrototype

func GetDagEthereumLinkPrototype

func GetDagEthereumLinkPrototype(codec string) ipld.LinkPrototype

func GetDagJOSELinkPrototype

func GetDagJOSELinkPrototype() ipld.LinkPrototype

func GetDagJSONLinkPrototype

func GetDagJSONLinkPrototype() ipld.LinkPrototype

func GetLinkPrototype

func GetLinkPrototype() ipld.LinkPrototype

func GetRawLinkPrototype

func GetRawLinkPrototype() ipld.LinkPrototype
func ParseCidLink(hash string) (cidlink.Link, error)

ParseCidLink parses a string cid multihash into a cidLink

func ReadFromStore

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

func ValueToJSON

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 AnconSyncContext

type AnconSyncContext struct {
	Store      Storage
	Exchange   graphsync.GraphExchange
	IPFSPeer   *peer.AddrInfo
	PrivateKey *ecdsa.PrivateKey
}

func NewAnconSyncContext

func NewAnconSyncContext(s Storage, exchange graphsync.GraphExchange, ipfspeer *peer.AddrInfo) *AnconSyncContext

type Storage

type Storage struct {
	LinkSystem linking.LinkSystem
	RootHash   cidlink.Link
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(db dbm.DB, version int64, cacheSize int) Storage

func (*Storage) Commit added in v1.5.7

func (s *Storage) Commit() (*pb.SaveVersionResponse, error)

SaveVersion saves a new IAVL tree version to the DB based on the current state (version) of the tree. It returns a result containing the hash and new version number.

func (*Storage) Get added in v1.5.2

func (s *Storage) Get(path []byte, id string) ([]byte, error)

func (*Storage) GetCommitmentProof added in v1.5.7

func (s *Storage) GetCommitmentProof(key []byte, version int64) (json.RawMessage, error)

GetCommitmentProof returns a result containing the IAVL tree version and value for a given key based on the current state (version) of the tree including a verifiable existing or not existing Commitment proof.

func (*Storage) GetTreeHash added in v1.5.7

func (s *Storage) GetTreeHash() []byte

func (*Storage) GetTreeHeight added in v1.5.7

func (s *Storage) GetTreeHeight() int8

func (*Storage) GetTreeVersion added in v1.5.7

func (s *Storage) GetTreeVersion() int64

func (*Storage) GetWithProof added in v1.5.7

func (s *Storage) GetWithProof(key []byte) (json.RawMessage, error)

GetWithProof returns a result containing the IAVL tree version and value for a given key based on the current state (version) of the tree including a verifiable Merkle proof.

func (*Storage) Has added in v1.5.7

func (s *Storage) Has(path []byte, id []byte) (bool, error)

func (*Storage) InitGenesis

func (s *Storage) InitGenesis(moniker []byte)

func (*Storage) Iterate added in v1.5.7

func (s *Storage) Iterate(path []byte, start, end []byte) (dbm.Iterator, error)

func (*Storage) Load

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

Load node from dag-json

func (*Storage) LoadGenesis

func (s *Storage) LoadGenesis(cid string)

func (*Storage) Put added in v1.5.2

func (s *Storage) Put(path []byte, id string, data []byte) (err error)

func (*Storage) Remove added in v1.5.2

func (s *Storage) Remove(path []byte, id string) error

func (*Storage) Store

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

Store node as dag-json

func (*Storage) StoreDagCBOR

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

Store node as dag-cbor

func (*Storage) StoreDagEth

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

Store node as dag-eth

func (*Storage) StoreRaw

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

Store node as raw

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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