Documentation
¶
Index ¶
- Constants
- func DetectableMethods(specName string, connectorTypes []specs.ApiConnectorType) mapset.Set[string]
- func IsForceEnabled(methodsConfig *config.MethodsConfig, method *specs.Method) bool
- type ChainMethods
- type GenericMethodsProcessor
- type Methods
- type MethodsDetector
- type MethodsProcessor
- type UpstreamMethods
Constants ¶
const DetectionInterval = time.Hour
DetectionInterval is how often an upstream's methods are re-detected. It is a flat constant rather than a multiple of validation-interval so that tightening health checks cannot silently multiply detection traffic: the answer changes only when a node is restarted with different --http.api flags, which is measured in months. dshackle detects once at launch and never again, so re-detecting hourly is already the more responsive end of the trade.
Variables ¶
This section is empty.
Functions ¶
func DetectableMethods ¶
DetectableMethods is the base set a detector may form opinions about: the chain's spec methods minus the locally-served ones. A local method is answered by nodecore itself, so whether the node implements it is irrelevant - and stripping one would remove it from the chain-level supported-method list that dshackle-mode clients read to decide what they can route here.
func IsForceEnabled ¶
func IsForceEnabled(methodsConfig *config.MethodsConfig, method *specs.Method) bool
IsForceEnabled reports whether the upstream's config pins this method on - by its own name, by its spec group, or by one of the synthetic groups every method belongs to.
It is the read side of the expansion NewUpstreamMethods performs above, and config enable is applied last there, so a method this returns true for can be neither banned nor stripped by detection. Checking the name alone is not enough: `enable: [trace]` names a group, and `enable: [default]` covers every method there is.
Types ¶
type ChainMethods ¶
type ChainMethods struct {
// contains filtered or unexported fields
}
func NewChainMethods ¶
func NewChainMethods(delegates []Methods) *ChainMethods
func (*ChainMethods) GetSupportedMethods ¶
func (c *ChainMethods) GetSupportedMethods() mapset.Set[string]
func (*ChainMethods) HasMethod ¶
func (c *ChainMethods) HasMethod(method string) bool
type GenericMethodsProcessor ¶
type GenericMethodsProcessor struct {
// contains filtered or unexported fields
}
func NewGenericMethodsProcessor ¶
func NewGenericMethodsProcessor( ctx context.Context, upstreamId string, detectors []MethodsDetector, delay time.Duration, ) *GenericMethodsProcessor
func (*GenericMethodsProcessor) Running ¶
func (m *GenericMethodsProcessor) Running() bool
func (*GenericMethodsProcessor) Start ¶
func (m *GenericMethodsProcessor) Start()
func (*GenericMethodsProcessor) Stop ¶
func (m *GenericMethodsProcessor) Stop()
func (*GenericMethodsProcessor) Subscribe ¶
func (m *GenericMethodsProcessor) Subscribe(name string) *utils.Subscription[mapset.Set[string]]
type MethodsDetector ¶
MethodsDetector reports which methods an upstream does not support. It returns the unsupported subset rather than the supported one, so that adding a detector can only ever narrow an upstream and never widen it.
The return value is three-valued, and the distinction carries the whole design:
- a non-empty set - "these methods are missing";
- an empty, non-nil set - "I asked, and nothing is missing";
- nil - "I have never managed to find out".
Collapsing the last two would make a node that is briefly unreachable indistinguishable from a fully-featured one, and republish an empty verdict that restores every method the previous round stripped. GenericMethodsProcessor keeps each detector's last non-nil verdict, so a detector that returns nil contributes what it last established rather than dropping out of the merge.
A detector that can answer for only part of its subject is expected to remember the rest itself, at whatever granularity it owns - see MethodProbeDetector, which retains per probe so that one timed-out call does not discard what it knows about the others.
type MethodsProcessor ¶
type MethodsProcessor interface {
utils.Lifecycle
Subscribe(name string) *utils.Subscription[mapset.Set[string]]
}
MethodsProcessor aggregates a chain's MethodsDetectors into a stream of the upstream's unsupported-method set.
type UpstreamMethods ¶
type UpstreamMethods struct {
// contains filtered or unexported fields
}
func NewUpstreamMethods ¶
func NewUpstreamMethods( methodSpecName string, methodsConfig *config.MethodsConfig, apiConnectorTypes []specs.ApiConnectorType, ) (*UpstreamMethods, error)
func (*UpstreamMethods) GetMethod ¶
func (u *UpstreamMethods) GetMethod(methodName string) *specs.Method
func (*UpstreamMethods) GetSupportedMethods ¶
func (u *UpstreamMethods) GetSupportedMethods() mapset.Set[string]
func (*UpstreamMethods) HasMethod ¶
func (u *UpstreamMethods) HasMethod(method string) bool