registry

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListResources = "list"
	GetResource   = "get"
	GetGraph      = "graph"
	GetTest       = "test"
)

Endpoints supported by the Querier.

View Source
const WirelineChainID = "wireline"

WirelineChainID is the Cosmos SDK chain ID.

Variables

This section is empty.

Functions

func BytesFromBase64

func BytesFromBase64(str string) []byte

BytesFromBase64 decodes a byte array from a base64 string.

func BytesFromHex

func BytesFromHex(str string) []byte

BytesFromHex decodes a byte array from a hex string.

func BytesToBase64

func BytesToBase64(bytes []byte) string

BytesToBase64 encodes a byte array as a base64 string.

func BytesToHex

func BytesToHex(bytes []byte) string

BytesToHex encodes a byte array as a hex string.

func GenRecordHash

func GenRecordHash(r Record) []byte

GenRecordHash generates a transaction hash.

func GetAddressFromPubKey

func GetAddressFromPubKey(pubKey crypto.PubKey) string

GetAddressFromPubKey gets an address from the public key.

func GetResourceSignature

func GetResourceSignature(record Record, name string) ([]byte, crypto.PubKey, error)

GetResourceSignature returns a cryptographic signature for a transaction.

func GraphResourceNode

func GraphResourceNode(g *dot.Graph, r Record) dot.Node

GraphResourceNode creates a node for a record.

func MarshalLinksToJSONBytes

func MarshalLinksToJSONBytes(val []map[string]interface{}) (bytes []byte)

MarshalLinksToJSONBytes converts []map[string]interface{} to bytes.

func MarshalMapToJSONBytes

func MarshalMapToJSONBytes(val map[string]interface{}) (bytes []byte)

MarshalMapToJSONBytes converts map[string]interface{} to bytes.

func MarshalSliceToJSONBytes

func MarshalSliceToJSONBytes(val []interface{}) (bytes []byte)

MarshalSliceToJSONBytes converts map[string]interface{} to bytes.

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

NewHandler returns a handler for "utxo" type messages.

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec.

func UnMarshalLinksFromJSONBytes

func UnMarshalLinksFromJSONBytes(bytes []byte) []map[string]interface{}

UnMarshalLinksFromJSONBytes converts bytes to []map[string]interface{}.

func UnMarshalMapFromJSONBytes

func UnMarshalMapFromJSONBytes(bytes []byte) map[string]interface{}

UnMarshalMapFromJSONBytes converts bytes to map[string]interface{}.

func UnMarshalSliceFromJSONBytes

func UnMarshalSliceFromJSONBytes(bytes []byte) []interface{}

UnMarshalSliceFromJSONBytes converts bytes to map[string]interface{}.

Types

type ID

type ID string

ID for records.

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine.

func NewKeeper

func NewKeeper(accountKeeper auth.AccountKeeper, coinKeeper bank.Keeper, resourceStoreKey sdk.StoreKey, cdc *codec.Codec) Keeper

NewKeeper creates new instances of the UTXO Keeper.

func (Keeper) ClearResources

func (k Keeper) ClearResources(ctx sdk.Context)

ClearResources - Deletes all records. NOTE: FOR LOCAL TESTING PURPOSES ONLY!

func (Keeper) DeleteResource

func (k Keeper) DeleteResource(ctx sdk.Context, id ID)

DeleteResource - deletes a record from the store.

func (Keeper) GetResource

func (k Keeper) GetResource(ctx sdk.Context, id ID) Record

GetResource - gets a record from the store.

func (Keeper) HasResource

func (k Keeper) HasResource(ctx sdk.Context, id ID) bool

HasResource - checks if a record by the given ID exists.

func (Keeper) ListResources

func (k Keeper) ListResources(ctx sdk.Context) []Record

ListResources - get all record records.

func (Keeper) PutResource

func (k Keeper) PutResource(ctx sdk.Context, record Record)

PutResource - saves a record to the store.

type MsgClearRecords

type MsgClearRecords struct {
	Signer sdk.AccAddress
}

MsgClearRecords defines a MsgClearRecords message.

func NewMsgClearRecords

func NewMsgClearRecords(signer sdk.AccAddress) MsgClearRecords

NewMsgClearRecords is the constructor function for MsgClearRecords.

func (MsgClearRecords) GetSignBytes

func (msg MsgClearRecords) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgClearRecords) GetSigners

func (msg MsgClearRecords) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgClearRecords) Route

func (msg MsgClearRecords) Route() string

Route Implements Msg.

func (MsgClearRecords) Type

func (msg MsgClearRecords) Type() string

Type Implements Msg.

func (MsgClearRecords) ValidateBasic

func (msg MsgClearRecords) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgDeleteRecord

type MsgDeleteRecord struct {
	Payload PayloadObj
	Signer  sdk.AccAddress
}

MsgDeleteRecord defines a DeleteResource message.

func NewMsgDeleteRecord

func NewMsgDeleteRecord(payload PayloadObj, signer sdk.AccAddress) MsgDeleteRecord

NewMsgDeleteRecord is the constructor function for MsgDeleteRecord.

func (MsgDeleteRecord) GetSignBytes

func (msg MsgDeleteRecord) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgDeleteRecord) GetSigners

func (msg MsgDeleteRecord) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgDeleteRecord) Route

func (msg MsgDeleteRecord) Route() string

Route Implements Msg.

func (MsgDeleteRecord) Type

func (msg MsgDeleteRecord) Type() string

Type Implements Msg.

func (MsgDeleteRecord) ValidateBasic

func (msg MsgDeleteRecord) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgSetRecord

type MsgSetRecord struct {
	Payload PayloadObj
	Signer  sdk.AccAddress
}

MsgSetRecord defines a SetResource message.

func NewMsgSetRecord

func NewMsgSetRecord(payload PayloadObj, signer sdk.AccAddress) MsgSetRecord

NewMsgSetRecord is the constructor function for MsgSetRecord.

func (MsgSetRecord) GetSignBytes

func (msg MsgSetRecord) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgSetRecord) GetSigners

func (msg MsgSetRecord) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgSetRecord) Route

func (msg MsgSetRecord) Route() string

Route Implements Msg.

func (MsgSetRecord) Type

func (msg MsgSetRecord) Type() string

Type Implements Msg.

func (MsgSetRecord) ValidateBasic

func (msg MsgSetRecord) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type Payload

type Payload struct {
	Record     Record      `json:"record"`
	Signatures []Signature `json:"signatures"`
}

Payload represents a signed record payload that can be serialized from/to YAML.

func PayloadObjToPayload

func PayloadObjToPayload(payloadObj PayloadObj) Payload

PayloadObjToPayload converts Payload to PayloadObj object. Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.

type PayloadObj

type PayloadObj struct {
	Record     RecordObj   `json:"record"`
	Signatures []Signature `json:"signatures"`
}

PayloadObj represents a signed record payload.

func PayloadToPayloadObj

func PayloadToPayloadObj(payload Payload) PayloadObj

PayloadToPayloadObj converts Payload to PayloadObj object. Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.

type Record

type Record struct {
	ID    ID     `json:"id"`
	Type  string `json:"type"`
	Owner string `json:"owner"`
	// SystemAttributes map[string]interface{}   `json:"systemAttributes"`
	Attributes map[string]interface{} `json:"attributes"`
}

Record represents a registry record that can be serialized from/to YAML.

func RecordObjToRecord

func RecordObjToRecord(resourceObj RecordObj) Record

RecordObjToRecord convers RecordObj to Record. Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.

type RecordObj

type RecordObj struct {
	ID    ID     `json:"id"`
	Type  string `json:"type"`
	Owner string `json:"owner"`
	// SystemAttributes []byte `json:"systemAttributes"`
	Attributes []byte `json:"attributes"`
}

RecordObj represents a registry record.

func RecordToRecordObj

func RecordToRecordObj(record Record) RecordObj

RecordToRecordObj convers Record to RecordObj. Why? Because go-amino can't handle maps: https://github.com/tendermint/go-amino/issues/4.

type Signature

type Signature struct {
	PubKey    string `json:"pubKey"`
	Signature string `json:"sig"`
}

Signature represents a record signature.

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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