api

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
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."
	UnauthorizedError              = -31401
	UnauthorizedErrorShort         = "Unauthorized"
	UnauthorizedErrorMessage       = "Action is not authorized."
	ExecutionError                 = -31103
	ExecutionErrorShort            = "Execution"
	ExecutionErrorMessage          = "Execution error."
	ServiceUnavailableError        = -31429
	ServiceUnavailableErrorShort   = "ServiceUnavailable"
	ServiceUnavailableErrorMessage = "Service unavailable, try again later."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminContractService added in v0.9.0

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

AdminContractService is a service that provides API for working with smart contracts.

func NewAdminContractService added in v0.9.0

func NewAdminContractService(runner *Runner) *AdminContractService

NewAdminContractService creates new AdminContract service instance.

func (*AdminContractService) Call added in v0.9.0

func (cs *AdminContractService) Call(req *http.Request, args *requester.Params, requestBody *rpc.RequestBody, result *requester.ContractResult) error

type ContractService added in v0.9.0

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

ContractService is a service that provides API for working with smart contracts.

func NewContractService added in v0.9.0

func NewContractService(runner *Runner) *ContractService

NewContractService creates new Contract service instance.

func (*ContractService) Call added in v0.9.0

func (cs *ContractService) Call(req *http.Request, args *requester.Params, requestBody *rpc.RequestBody, result *requester.ContractResult) error

type DummyArgs added in v0.9.0

type DummyArgs struct{}

type DummyReply added in v0.9.0

type DummyReply struct{}

type FuncTestContractService added in v0.9.0

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

FuncTestContractService is a service that provides ability to add custom contracts

func NewFuncTestContractService added in v0.9.0

func NewFuncTestContractService(runner *Runner) *FuncTestContractService

NewFuncTestContractService is dummy for NewFuncTestContractService in functest_contract.go that hidden under build tag

func (*FuncTestContractService) CallConstructor added in v0.9.0

func (s *FuncTestContractService) CallConstructor(r *http.Request, args *DummyArgs, requestBody *rpc.RequestBody, reply *DummyReply) error

func (*FuncTestContractService) CallMethod added in v0.9.0

func (s *FuncTestContractService) CallMethod(r *http.Request, args *DummyArgs, requestBody *rpc.RequestBody, reply *DummyReply) error

func (*FuncTestContractService) Upload added in v0.9.0

func (s *FuncTestContractService) Upload(r *http.Request, args *DummyArgs, requestBody *rpc.RequestBody, reply *DummyReply) error

type HealthChecker added in v0.8.7

type HealthChecker struct {
	CertificateManager insolar.CertificateManager
	NodeNetwork        network.NodeNetwork
	PulseAccessor      pulse.Accessor
}

HealthChecker allows to check network status of a node.

func NewHealthChecker added in v0.8.7

NewHealthChecker creates new HealthChecker.

func (*HealthChecker) CheckHandler added in v0.8.7

func (hc *HealthChecker) CheckHandler(w http.ResponseWriter, r *http.Request)

CheckHandler is a HTTP handler for health check.

type InfoArgs added in v0.6.3

type InfoArgs struct{}

InfoArgs is arguments that Info service accepts.

type InfoReply added in v0.6.3

type InfoReply struct {
	RootDomain             string   `json:"rootDomain"`
	RootMember             string   `json:"rootMember"`
	MigrationAdminMember   string   `json:"migrationAdminMember"`
	FeeMember              string   `json:"feeMember"`
	MigrationDaemonMembers []string `json:"migrationDaemonMembers"`
	NodeDomain             string   `json:"nodeDomain"`
	TraceID                string   `json:"traceID"`
}

InfoReply is reply for Info service requests.

type InfoService added in v0.6.3

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

InfoService is a service that provides API for getting info about genesis objects.

func NewInfoService added in v0.6.3

func NewInfoService(runner *Runner) *InfoService

NewInfoService creates new Info service instance.

func (*InfoService) GetInfo added in v0.9.0

func (s *InfoService) GetInfo(r *http.Request, args *InfoArgs, requestBody *rpc.RequestBody, reply *InfoReply) error

type NetworkChecker added in v0.9.8

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 added in v0.9.8

func NewNetworkChecker(cfg configuration.AvailabilityChecker) *NetworkChecker

func (*NetworkChecker) IsAvailable added in v0.9.8

func (nc *NetworkChecker) IsAvailable(ctx context.Context) bool

func (*NetworkChecker) Start added in v0.9.8

func (nc *NetworkChecker) Start(ctx context.Context) error

func (*NetworkChecker) Stop added in v0.9.11

func (nc *NetworkChecker) Stop()

type NodeCertArgs added in v0.7.5

type NodeCertArgs struct {
	Ref string
}

NodeCertArgs is arguments that NodeCert service accepts.

type NodeCertReply added in v0.7.5

type NodeCertReply struct {
	Cert *certificate.Certificate `json:"cert"`
}

NodeCertReply is reply for NodeCert service requests.

type NodeCertService added in v0.7.5

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

NodeCertService is a service that provides cert for node.

func NewNodeCertService added in v0.7.5

func NewNodeCertService(runner *Runner) *NodeCertService

NewNodeCertService creates new NodeCert service instance.

func (*NodeCertService) Get added in v0.7.5

func (s *NodeCertService) Get(r *http.Request, args *NodeCertArgs, requestBody *rpc.RequestBody, reply *NodeCertReply) error

type NodeService added in v0.9.0

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

NodeService is a service that provides API for getting new seed and status.

func NewNodeService added in v0.9.0

func NewNodeService(runner *Runner) *NodeService

NewNodeService creates new Node service instance.

func (*NodeService) GetSeed added in v0.9.0

func (s *NodeService) GetSeed(r *http.Request, args *SeedArgs, requestBody *rpc.RequestBody, reply *requester.SeedReply) error

func (*NodeService) GetStatus added in v0.9.0

func (s *NodeService) GetStatus(r *http.Request, args *interface{}, requestBody *rpc.RequestBody, reply *requester.StatusResponse) error

Get returns status info

type Runner

type Runner struct {
	CertificateManager insolar.CertificateManager
	ContractRequester  insolar.ContractRequester
	// nolint
	NodeNetwork         network.NodeNetwork
	CertificateGetter   insolar.CertificateGetter
	PulseAccessor       pulse.Accessor
	ArtifactManager     artifacts.Client
	JetCoordinator      jet.Coordinator
	NetworkStatus       insolar.NetworkStatus
	AvailabilityChecker insolar.AvailabilityChecker

	SeedManager   *seedmanager.SeedManager
	SeedGenerator seedmanager.SeedGenerator
	// contains filtered or unexported fields
}

Runner implements Component for API

func NewRunner

func NewRunner(cfg *configuration.APIRunner,
	certificateManager insolar.CertificateManager,
	contractRequester insolar.ContractRequester,

	nodeNetwork network.NodeNetwork,
	certificateGetter insolar.CertificateGetter,
	pulseAccessor pulse.Accessor,
	artifactManager artifacts.Client,
	jetCoordinator jet.Coordinator,
	networkStatus insolar.NetworkStatus,
	availabilityChecker insolar.AvailabilityChecker,
) (*Runner, error)

NewRunner is C-tor for API Runner

func (*Runner) Handler added in v0.9.5

func (ar *Runner) Handler() http.Handler

Handler returns root http handler.

func (*Runner) IsAPIRunner added in v0.6.3

func (ar *Runner) IsAPIRunner() bool

IsAPIRunner is implementation of APIRunner interface for component manager

func (*Runner) Start

func (ar *Runner) Start(ctx context.Context) error

Start runs api server

func (*Runner) Stop

func (ar *Runner) Stop(ctx context.Context) error

Stop stops api server

type RunnerWrapper added in v0.9.0

type RunnerWrapper struct {
	API      insolar.APIRunner
	AdminAPI insolar.APIRunner
}

func NewWrapper added in v0.9.0

func NewWrapper(publicAPI, adminAPI insolar.APIRunner) *RunnerWrapper

NewWrapper is C-tor for wrapper of API Runner

func (*RunnerWrapper) Start added in v0.9.0

func (w *RunnerWrapper) Start(ctx context.Context) error

Start runs api servers

func (*RunnerWrapper) Stop added in v0.9.0

func (w *RunnerWrapper) Stop(ctx context.Context) error

Start stops api servers

type SeedArgs added in v0.6.3

type SeedArgs struct{}

SeedArgs is arguments that Seed service accepts.

type UploadReply added in v0.9.0

type UploadReply struct {
	PrototypeRef string `json:"PrototypeRef"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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