api

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalRequest added in v0.6.3

func UnmarshalRequest(req *http.Request, params interface{}) ([]byte, error)

UnmarshalRequest unmarshals request to api

Types

type HealthChecker added in v0.8.7

type HealthChecker struct {
	CertificateManager core.CertificateManager
	NodeNetwork        core.NodeNetwork
}

HealthChecker allows to check network status of a node.

func NewHealthChecker added in v0.8.7

func NewHealthChecker(cm core.CertificateManager, nn core.NodeNetwork) *HealthChecker

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
	RootMember string
	NodeDomain string
	TraceID    string
}

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) Get added in v0.6.3

func (s *InfoService) Get(r *http.Request, args *InfoArgs, reply *InfoReply) error

Get returns info about genesis objects.

  Request structure:
  {
    "jsonrpc": "2.0",
    "method": "info.Get",
    "id": str|int|null
  }

    Response structure:
	{
		"jsonrpc": "2.0",
		"result": {
			"RootDomain": str, // reference to RootDomain instance
			"RootMember": str, // reference to RootMember instance
			"NodeDomain": str, // reference to NodeDomain instance
			"TraceID": str // traceID for request
		},
		"id": str|int|null // same as in request
	}

type Node added in v0.7.5

type Node struct {
	Reference string
	Role      string
	IsWorking bool
}

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, reply *NodeCertReply) error

Get returns certificate for node with given reference.

type Request added in v0.6.3

type Request struct {
	Reference string `json:"reference"`
	Method    string `json:"method"`
	Params    []byte `json:"params"`
	Seed      []byte `json:"seed"`
	Signature []byte `json:"signature"`
}

Request is a representation of request struct to api

type Runner

type Runner struct {
	CertificateManager  core.CertificateManager  `inject:""`
	StorageExporter     core.StorageExporter     `inject:""`
	ContractRequester   core.ContractRequester   `inject:""`
	NetworkCoordinator  core.NetworkCoordinator  `inject:""`
	GenesisDataProvider core.GenesisDataProvider `inject:""`
	NetworkSwitcher     core.NetworkSwitcher     `inject:""`
	NodeNetwork         core.NodeNetwork         `inject:""`
	PulseStorage        core.PulseStorage        `inject:""`

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

Runner implements Component for API

func NewRunner

func NewRunner(cfg *configuration.APIRunner) (*Runner, error)

NewRunner is C-tor for API Runner

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

type SeedArgs struct{}

SeedArgs is arguments that Seed service accepts.

type SeedReply added in v0.6.3

type SeedReply struct {
	Seed    []byte
	TraceID string
}

SeedReply is reply for Seed service requests.

type SeedService added in v0.6.3

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

SeedService is a service that provides API for getting new seed.

func NewSeedService added in v0.6.3

func NewSeedService(runner *Runner) *SeedService

NewSeedService creates new Seed service instance.

func (*SeedService) Get added in v0.6.3

func (s *SeedService) Get(r *http.Request, args *SeedArgs, reply *SeedReply) error

Get returns new active seed.

  Request structure:
  {
    "jsonrpc": "2.0",
    "method": "seed.Get",
    "id": str|int|null
  }

    Response structure:
	{
		"jsonrpc": "2.0",
		"result": {
			"Seed": str, // correct seed for new Call request
			"TraceID": str // traceID for request
		},
		"id": str|int|null // same as in request
	}

type StatusReply added in v0.7.5

type StatusReply struct {
	NetworkState        string
	Origin              Node
	ActiveListSize      int
	WorkingListSize     int
	Nodes               []Node
	PulseNumber         uint32
	Entropy             []byte
	NodeState           string
	AdditionalNodeState string
	Version             string
}

StatusReply is reply for Status service requests.

type StatusService added in v0.7.5

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

StatusService is a service that provides API for getting status of node.

func NewStatusService added in v0.7.5

func NewStatusService(runner *Runner) *StatusService

NewStatusService creates new StatusService instance.

func (*StatusService) Get added in v0.7.5

func (s *StatusService) Get(r *http.Request, args *interface{}, reply *StatusReply) error

Get returns status info

type StorageExporterArgs added in v0.6.3

type StorageExporterArgs struct {
	From uint32
	Size int
}

StorageExporterArgs is arguments that StorageExporter service accepts.

type StorageExporterReply added in v0.6.3

type StorageExporterReply = core.StorageExportResult

StorageExporterReply is reply for StorageExporter service requests.

type StorageExporterService added in v0.6.3

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

StorageExporterService is a service that provides API for exporting storage data.

func NewStorageExporterService added in v0.6.3

func NewStorageExporterService(runner *Runner) *StorageExporterService

NewStorageExporterService creates new StorageExporter service instance.

func (*StorageExporterService) Export added in v0.6.3

Export returns data view from storage.

Request structure:
{
  "jsonrpc": "2.0",
  "method": "exporter.Export",
  "params": {
    // Pulse number from which data load should start.
    // If less than first pulse, the load will start from the first pulse (e.i. use "0" to load from the beginning).
    "From": int,
    // Number of pulses to load.
    "Size": int
    },
  "id": str|int|null
}

Response structure:
{
  "Data": {
    [pulse number]: [{
      "Records": {
        [record ID]: {
          "Type": str, // Constant record type.
          "Data": { ... }, // Structured record data.
          "Payload": { ... }|null // Additional data related to the record (e.g. Object's memory).
      }
    },
      "Pulse": {
        "PulseNumber": int, // Pulse number. Same as parent key.
      },
      "JetID": string,
    }],
    "NextFrom": int|null, // Pulse number from which to start next batch. Put it as "From" param for next incremental fetch.
    "Size": int // Number of returned pulses (length of the "Data" dictionary).
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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