togglerouter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "router"

	// DefaultParamspace for params keeper
	DefaultParamspace = ModuleName
)

Variables

View Source
var ModuleCdc *codec.Codec

module codec

View Source
var ParamStoreKeyDisabledRoutes = []byte("disabledroutes")

ParamStoreKeyDisabledRoutes is store's key for DisabledRoutes

Functions

func InitGenesis

func InitGenesis(ctx sdk.Context, router *Router, data GenesisState)

InitGenesis sets distribution information for genesis.

func NewAppModule

func NewAppModule(router *Router) module.AppModule

NewAppModule creates a new AppModule object

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable type declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of bank genesis data returning an error for any failed validation criteria.

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements an application module for the genutil module.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the genutil module.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the genutil module. It returns no validator updates.

type AppModuleBasic

type AppModuleBasic struct{}

AppModuleBasic defines the basic application module used by the togglerouter module.

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the genutil module.

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(_ *codec.Codec) *cobra.Command

GetQueryCmd returns no root query command for the genutil module.

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command

GetTxCmd returns no root tx command for the genutil module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the togglerouter module's name.

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the togglerouter module's types for the given codec.

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(_ context.CLIContext, _ *mux.Router)

RegisterRESTRoutes registers the REST routes for the genutil module.

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the togglerouter module.

type GenesisState

type GenesisState struct {
	DisabledRoutes []string `json:"disabled_routes"`
}

GenesisState is the bank state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func ExportGenesis

func ExportGenesis(ctx sdk.Context, router *Router) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

func NewGenesisState

func NewGenesisState(disabledRoutes []string) GenesisState

NewGenesisState creates a new genesis state.

type Router

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

func NewRouter

func NewRouter(paramSpace params.Subspace) *Router

NewRouter returns a reference to a new router.

func (*Router) AddRoute

func (rtr *Router) AddRoute(path string, h sdk.Handler) sdk.Router

AddRoute adds a route path to the router with a given handler. The route must be alphanumeric.

func (*Router) GetRouteDisabled

func (rtr *Router) GetRouteDisabled(ctx sdk.Context, route string) bool

GetRouteEnabled returns whether a specific route is disabled from the global param store

func (*Router) Route

func (rtr *Router) Route(ctx sdk.Context, path string) sdk.Handler

Route returns a handler for a given route path.

TODO: Handle expressive matches.

func (*Router) SetRouteDisabled

func (rtr *Router) SetRouteDisabled(ctx sdk.Context, route string, disabled bool)

SetRouteEnabled sets whether a specific route is disabled from the global param store

Jump to

Keyboard shortcuts

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