module

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPQuery

type HTTPQuery struct {
	// Name of the RPC func.
	Name string

	// FullName of the query with service name and rpc func name.
	FullName string

	// HTTPAnnotations keeps info about http annotations of query.
	Rules []protoanalysis.HTTPRule
}

HTTPQuery is an sdk Query.

type Module

type Module struct {
	// Name of the module.
	Name string

	// Pkg holds the proto package info.
	Pkg protoanalysis.Package

	// Msg is a list of sdk.Msg implementation of the module.
	Msgs []Msg

	// HTTPQueries is a list of module queries.
	HTTPQueries []HTTPQuery

	// Types is a list of proto types that might be used by module.
	Types []Type
}

Module keeps metadata about a Cosmos SDK module.

func Discover

func Discover(ctx context.Context, sourcePath, protoDir string) ([]Module, error)

Discover discovers and returns modules and their types that implements sdk.Msg. sourcePath is the root path of an sdk blockchain.

discovery algorithm make use of proto definitions to discover modules inside the blockchain.

checking whether a type implements sdk.Msg is done by running a simple algorithm of comparing method names of each type in a package with sdk.Msg's, which satisfies our needs for the time being. for a more opinionated check:

  • go/types.Implements() might be utilized and as needed.
  • instead of just comparing method names, their full signatures can be compared.

type Msg

type Msg struct {
	// Name of the type.
	Name string

	// URI of the type.
	URI string

	// FilePath is the path of the .proto file where message is defined at.
	FilePath string
}

Msg keeps metadata about an sdk.Msg implementation.

type Msgs

type Msgs map[string][]string

Msgs is a module import path-sdk msgs pair.

type Type

type Type struct {
	Name string

	// FilePath is the path of the .proto file where message is defined at.
	FilePath string
}

Type is a proto type that might be used by module.

Jump to

Keyboard shortcuts

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