specs

package
v0.0.0-...-6d1d3b9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthBlockNumber      = "eth_blockNumber"
	EthGetBlockByNumber = "eth_getBlockByNumber"
	EthChainId          = "eth_chainId"
	NetVersion          = "net_version"
)
View Source
const (
	DefaultMethodGroup = "default"
	SpecPathVar        = "NODECORE_SPECS_PATH"
)

Variables

This section is empty.

Functions

func GetSpecMethods

func GetSpecMethods(specName string) map[string]map[string]*Method

func GetUnsubscribeMethod

func GetUnsubscribeMethod(specName, methodName string) (string, bool)

func IsBlockTagNumber

func IsBlockTagNumber(num rpc.BlockNumber) bool

func IsLocalMethod

func IsLocalMethod(specName, methodName string) bool

func IsStickyCreateMethod

func IsStickyCreateMethod(specMethod *Method) bool

func IsStickySendMethod

func IsStickySendMethod(specMethod *Method) bool

func IsSubscribeMethod

func IsSubscribeMethod(specName, methodName string) bool

Types

type BlockNumberParam

type BlockNumberParam struct {
	BlockNumber rpc.BlockNumber
}

type BlockRangeParam

type BlockRangeParam struct {
	From *rpc.BlockNumber
	To   *rpc.BlockNumber
}

type HashTagParam

type HashTagParam struct {
	Hash string
}

type Method

type Method struct {
	Subscription *Subscription
	Sticky       *Sticky
	Name         string
	// contains filtered or unexported fields
}

func DefaultMethod

func DefaultMethod(name string) *Method

func GetSpecMethod

func GetSpecMethod(specName, methodName string) *Method

func MethodWithSettings

func MethodWithSettings(name string, settings *MethodSettings, tagParser *TagParser) *Method

func (*Method) Enabled

func (m *Method) Enabled() bool

func (*Method) IsCacheable

func (m *Method) IsCacheable() bool

func (*Method) IsLocal

func (m *Method) IsLocal() bool

func (*Method) Modify

func (m *Method) Modify(ctx context.Context, data any, newV any) []byte

func (*Method) Parse

func (m *Method) Parse(ctx context.Context, data any) MethodParam

func (*Method) ShouldEnforceIntegrity

func (m *Method) ShouldEnforceIntegrity() bool

type MethodData

type MethodData struct {
	Name      string          `json:"name"`
	Group     string          `json:"group"`
	Settings  *MethodSettings `json:"settings"`
	TagParser *TagParser      `json:"tag-parser"`
	Enabled   *bool           `json:"enabled"`
}

type MethodParam

type MethodParam interface {
	// contains filtered or unexported methods
}

type MethodSettings

type MethodSettings struct {
	Cacheable        *bool         `json:"cacheable"`
	EnforceIntegrity bool          `json:"enforce-integrity"`
	Sticky           *Sticky       `json:"sticky"`
	Subscription     *Subscription `json:"subscription"`
	Local            bool          `json:"local"`
}

type MethodSpec

type MethodSpec struct {
	SpecData    *SpecData     `json:"spec"`
	SpecImports []string      `json:"spec-imports"`
	Methods     []*MethodData `json:"methods"`
}

type MethodSpecLoader

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

func NewMethodSpecLoader

func NewMethodSpecLoader() MethodSpecLoader

func NewMethodSpecLoaderWithFs

func NewMethodSpecLoaderWithFs(specsFS fs.FS) MethodSpecLoader

func (MethodSpecLoader) Load

func (m MethodSpecLoader) Load() error

type ParserReturnType

type ParserReturnType string
const (
	BlockNumberType ParserReturnType = "blockNumber" // hex number or tag (latest, earliest, etc)
	BlockRefType    ParserReturnType = "blockRef"    // hash, hex number or tag (latest, earliest, etc)
	ObjectType      ParserReturnType = "object"      // generic object
	StringType      ParserReturnType = "string"      // string values
	BlockRangeType  ParserReturnType = "blockRange"  // block range (from, to)
)

type SpecData

type SpecData struct {
	Name string `json:"name"`
}

type Sticky

type Sticky struct {
	SendSticky   bool `json:"send-sticky"`   // to send to the same node
	CreateSticky bool `json:"create-sticky"` // to add an upstream index to the payload
}

type StringParam

type StringParam struct {
	Value string
}

type Subscription

type Subscription struct {
	IsSubscribe bool   `json:"is-subscribe"`
	UnsubMethod string `json:"unsubscribe-method"`
}

type TagParser

type TagParser struct {
	ReturnType ParserReturnType `json:"type"`
	Path       string           `json:"path"`
}

Jump to

Keyboard shortcuts

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