api

package
v0.0.0-...-5de87d6 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 32 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

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

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

func NewAdminContractService

func NewAdminContractService(runner *Runner) *AdminContractService

NewAdminContractService creates new AdminContract service instance.

func (*AdminContractService) Call

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

type ContractService

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

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

func NewContractService

func NewContractService(runner *Runner) *ContractService

NewContractService creates new Contract service instance.

func (*ContractService) Call

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

type DummyArgs

type DummyArgs struct{}

type DummyReply

type DummyReply struct{}

type FuncTestContractService

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

FuncTestContractService is a service that provides ability to add custom contracts

func NewFuncTestContractService

func NewFuncTestContractService(runner *Runner) *FuncTestContractService

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

func (*FuncTestContractService) CallConstructor

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

func (*FuncTestContractService) CallMethod

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

func (*FuncTestContractService) Upload

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

type HealthChecker

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

HealthChecker allows to check network status of a node.

func NewHealthChecker

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 InfoArgs

type InfoArgs struct{}

InfoArgs is arguments that Info service accepts.

type InfoReply

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

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

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

func NewInfoService

func NewInfoService(runner *Runner) *InfoService

NewInfoService creates new Info service instance.

func (*InfoService) GetInfo

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

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 (*NetworkChecker) IsAvailable

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

func (*NetworkChecker) Start

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

func (*NetworkChecker) Stop

func (nc *NetworkChecker) Stop()

type NodeCertArgs

type NodeCertArgs struct {
	Ref string
}

NodeCertArgs is arguments that NodeCert service accepts.

type NodeCertReply

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

NodeCertReply is reply for NodeCert service requests.

type NodeCertService

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

NodeCertService is a service that provides cert for node.

func NewNodeCertService

func NewNodeCertService(runner *Runner) *NodeCertService

NewNodeCertService creates new NodeCert service instance.

func (*NodeCertService) Get

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

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) GetSeed

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

func (*NodeService) GetStatus

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

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

Handler returns root http handler.

func (*Runner) IsAPIRunner

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

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

func NewWrapper

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

NewWrapper is C-tor for wrapper of API Runner

func (*RunnerWrapper) Start

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

Start runs api servers

func (*RunnerWrapper) Stop

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

Start stops api servers

type SeedArgs

type SeedArgs struct{}

SeedArgs is arguments that Seed service accepts.

type UploadReply

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