Documentation ¶
Index ¶
- Constants
- func IsInternalMethod(method string) bool
- type APIRunner
- type AvailabilityChecker
- type AvailabilityCheckerMock
- func (mmIsAvailable *AvailabilityCheckerMock) IsAvailable(ctx context.Context) (b1 bool)
- func (mmIsAvailable *AvailabilityCheckerMock) IsAvailableAfterCounter() uint64
- func (mmIsAvailable *AvailabilityCheckerMock) IsAvailableBeforeCounter() uint64
- func (m *AvailabilityCheckerMock) MinimockFinish()
- func (m *AvailabilityCheckerMock) MinimockIsAvailableDone() bool
- func (m *AvailabilityCheckerMock) MinimockIsAvailableInspect()
- func (m *AvailabilityCheckerMock) MinimockWait(timeout mm_time.Duration)
- type AvailabilityCheckerMockIsAvailableExpectation
- type AvailabilityCheckerMockIsAvailableParams
- type AvailabilityCheckerMockIsAvailableResults
- type DummyNetworkChecker
- type HealthChecker
- type NetworkChecker
- type NodeService
- type RequestValidator
- type Runner
- type RunnerWrapper
- type SeedArgs
Constants ¶
const ( ParseError = -31700 ParseErrorShort = "ParseError" ParseErrorMessage = "Parsing error on the server side: received an invalid JSON." InvalidRequestError = -31600 InvalidRequestErrorShort = "InvalidRequest" InvalidRequestErrorMessage = "The JSON received is not a valid request payload." MethodNotFoundError = -31601 MethodNotFoundErrorShort = "MethodNotFound" MethodNotFoundErrorMessage = "Method does not exist / is not available." InvalidParamsError = -31602 InvalidParamsErrorShort = "InvalidParams" InvalidParamsErrorMessage = "Invalid method parameter(s)." InternalError = -31603 InternalErrorShort = "Internal" InternalErrorMessage = "Internal Platform error." TimeoutError = -31106 TimeoutErrorShort = "Timeout" TimeoutErrorMessage = "Request's timeout has expired." ExecutionError = -31103 ExecutionErrorShort = "Execution" ExecutionErrorMessage = "Execution error." )
Variables ¶
This section is empty.
Functions ¶
func IsInternalMethod ¶
Types ¶
type AvailabilityChecker ¶
AvailabilityChecker component checks if insolar network can't process any new requests
type AvailabilityCheckerMock ¶
type AvailabilityCheckerMock struct { IsAvailableMock mAvailabilityCheckerMockIsAvailable // contains filtered or unexported fields }
AvailabilityCheckerMock implements AvailabilityChecker
func NewAvailabilityCheckerMock ¶
func NewAvailabilityCheckerMock(t minimock.Tester) *AvailabilityCheckerMock
NewAvailabilityCheckerMock returns a mock for AvailabilityChecker
func (*AvailabilityCheckerMock) IsAvailable ¶
func (mmIsAvailable *AvailabilityCheckerMock) IsAvailable(ctx context.Context) (b1 bool)
IsAvailable implements AvailabilityChecker
func (*AvailabilityCheckerMock) IsAvailableAfterCounter ¶
func (mmIsAvailable *AvailabilityCheckerMock) IsAvailableAfterCounter() uint64
IsAvailableAfterCounter returns a count of finished AvailabilityCheckerMock.IsAvailable invocations
func (*AvailabilityCheckerMock) IsAvailableBeforeCounter ¶
func (mmIsAvailable *AvailabilityCheckerMock) IsAvailableBeforeCounter() uint64
IsAvailableBeforeCounter returns a count of AvailabilityCheckerMock.IsAvailable invocations
func (*AvailabilityCheckerMock) MinimockFinish ¶
func (m *AvailabilityCheckerMock) MinimockFinish()
MinimockFinish checks that all mocked methods have been called the expected number of times
func (*AvailabilityCheckerMock) MinimockIsAvailableDone ¶
func (m *AvailabilityCheckerMock) MinimockIsAvailableDone() bool
MinimockIsAvailableDone returns true if the count of the IsAvailable invocations corresponds the number of defined expectations
func (*AvailabilityCheckerMock) MinimockIsAvailableInspect ¶
func (m *AvailabilityCheckerMock) MinimockIsAvailableInspect()
MinimockIsAvailableInspect logs each unmet expectation
func (*AvailabilityCheckerMock) MinimockWait ¶
func (m *AvailabilityCheckerMock) MinimockWait(timeout mm_time.Duration)
MinimockWait waits for all mocked methods to be called the expected number of times
type AvailabilityCheckerMockIsAvailableExpectation ¶
type AvailabilityCheckerMockIsAvailableExpectation struct { Counter uint64 // contains filtered or unexported fields }
AvailabilityCheckerMockIsAvailableExpectation specifies expectation struct of the AvailabilityChecker.IsAvailable
func (*AvailabilityCheckerMockIsAvailableExpectation) Then ¶
func (e *AvailabilityCheckerMockIsAvailableExpectation) Then(b1 bool) *AvailabilityCheckerMock
Then sets up AvailabilityChecker.IsAvailable return parameters for the expectation previously defined by the When method
type AvailabilityCheckerMockIsAvailableParams ¶
type AvailabilityCheckerMockIsAvailableParams struct {
// contains filtered or unexported fields
}
AvailabilityCheckerMockIsAvailableParams contains parameters of the AvailabilityChecker.IsAvailable
type AvailabilityCheckerMockIsAvailableResults ¶
type AvailabilityCheckerMockIsAvailableResults struct {
// contains filtered or unexported fields
}
AvailabilityCheckerMockIsAvailableResults contains results of the AvailabilityChecker.IsAvailable
type DummyNetworkChecker ¶
type DummyNetworkChecker struct{}
func NewDummyNetworkChecker ¶
func NewDummyNetworkChecker(_ configuration.AvailabilityChecker) *DummyNetworkChecker
func (DummyNetworkChecker) IsAvailable ¶
func (d DummyNetworkChecker) IsAvailable(ctx context.Context) bool
type HealthChecker ¶
type HealthChecker struct { CertificateManager nodeinfo.CertificateManager NodeNetwork beat.NodeNetwork }
HealthChecker allows to check network status of a node.
func NewHealthChecker ¶
func NewHealthChecker(cm nodeinfo.CertificateManager, nn beat.NodeNetwork) *HealthChecker
NewHealthChecker creates new HealthChecker.
func (*HealthChecker) CheckHandler ¶
func (hc *HealthChecker) CheckHandler(w http.ResponseWriter, r *http.Request)
CheckHandler is a HTTP handler for health check.
type NetworkChecker ¶
type NetworkChecker struct {
// contains filtered or unexported fields
}
NetworkChecker is AvailabilityChecker implementation that checks can we process any API requests based on keeper status
func NewNetworkChecker ¶
func NewNetworkChecker(cfg configuration.AvailabilityChecker) *NetworkChecker
func (*NetworkChecker) IsAvailable ¶
func (nc *NetworkChecker) IsAvailable(ctx context.Context) bool
func (*NetworkChecker) Stop ¶
func (nc *NetworkChecker) Stop()
func (*NetworkChecker) UpdateAvailability ¶
func (nc *NetworkChecker) UpdateAvailability(ctx context.Context)
type NodeService ¶
type NodeService struct {
// contains filtered or unexported fields
}
NodeService is a service that provides API for getting new seed and status.
func NewNodeService ¶
func NewNodeService(runner *Runner) *NodeService
NewNodeService creates new Node service instance.
func (*NodeService) GetStatus ¶
func (s *NodeService) GetStatus(r *http.Request, args *interface{}, requestBody *rpc.RequestBody, reply *requester.StatusResponse) error
Get returns status info
type RequestValidator ¶
type RequestValidator struct {
// contains filtered or unexported fields
}
func NewRequestValidator ¶
func NewRequestValidator(path string, next http.Handler) (*RequestValidator, error)
func (*RequestValidator) ServeHTTP ¶
func (rv *RequestValidator) ServeHTTP(w http.ResponseWriter, httpReq *http.Request)
type Runner ¶
type Runner struct { CertificateManager nodeinfo.CertificateManager // nolint NodeNetwork beat.NodeNetwork CertificateGetter nodeinfo.CertificateGetter PulseAccessor beat.History JetCoordinator affinity.Helper NetworkStatus network.Status AvailabilityChecker AvailabilityChecker SeedManager *seedmanager.SeedManager SeedGenerator seedmanager.SeedGenerator // contains filtered or unexported fields }
Runner implements Component for API
func NewRunner ¶
func NewRunner(cfg *configuration.APIRunner, logger log.Logger, certificateManager nodeinfo.CertificateManager, nodeNetwork beat.NodeNetwork, certificateGetter nodeinfo.CertificateGetter, pulseAccessor beat.History, jetCoordinator affinity.Helper, networkStatus network.Status, availabilityChecker AvailabilityChecker, ) (*Runner, error)
NewRunner is C-tor for API Runner
func (*Runner) IsAPIRunner ¶
IsAPIRunner is implementation of APIRunner interface for component manager
type RunnerWrapper ¶
func NewWrapper ¶
func NewWrapper(publicAPI, adminAPI APIRunner) *RunnerWrapper
NewWrapper is C-tor for wrapper of API Runner