service

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AirblocBackend

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

AirblocBackend is implements of Airbloc node service. it composes all service used by Airbloc.

func (*AirblocBackend) AttachService

func (airbloc *AirblocBackend) AttachService(name string, service Service)

func (*AirblocBackend) Client

func (airbloc *AirblocBackend) Client() *blockchain.Client

func (*AirblocBackend) Config

func (airbloc *AirblocBackend) Config() *Config

func (*AirblocBackend) DetachService

func (airbloc *AirblocBackend) DetachService(name string)

func (*AirblocBackend) GetService

func (airbloc *AirblocBackend) GetService(name string) Service

func (*AirblocBackend) Kms

func (airbloc *AirblocBackend) Kms() key.Manager

func (*AirblocBackend) LocalDatabase

func (airbloc *AirblocBackend) LocalDatabase() localdb.Database

func (*AirblocBackend) MetaDatabase

func (airbloc *AirblocBackend) MetaDatabase() metadb.Database

func (*AirblocBackend) P2P

func (airbloc *AirblocBackend) P2P() p2p.Server

func (*AirblocBackend) Start

func (airbloc *AirblocBackend) Start() error

func (*AirblocBackend) Stop

func (airbloc *AirblocBackend) Stop()

type Backend

type Backend interface {
	Kms() key.Manager
	Client() *blockchain.Client
	MetaDatabase() metadb.Database
	LocalDatabase() localdb.Database
	Config() *Config
	P2P() p2p.Server

	Service
	GetService(string) Service
	AttachService(string, Service)
	DetachService(string)
}

func NewAirblocBackend

func NewAirblocBackend(nodeKey *key.Key, config *Config) (Backend, error)

type Config

type Config struct {
	Env string `default:"production"`

	// private keys
	Key     string `yaml:"key"`
	KeyPath string `default:"private.key" yaml:"keyPath" split_words:"true"`

	// api/rpc listen address
	Host string `default:"localhost" yaml:"host"`
	Port int    `default:"2471" yaml:"port"`

	// logger settings
	LogLevel  string `default:"*" yaml:"logLevel" split_words:"true"`
	LogFilter string `default:"*" yaml:"logFilter" split_words:"true"`

	P2P struct {
		ListenAddr string   `default:"/ip4/0.0.0.0/tcp/2472" yaml:"listenAddr" split_words:"true"`
		BootNodes  []string `yaml:"bootNodes" split_words:"true"`
	} `yaml:"p2p"`

	LocalDB struct {
		Path    string `default:"local/"`
		Version int    `default:"1"`
	} `yaml:"localDB" split_words:"true"`

	MetaDB struct {
		MongoDBEndpoint string `default:"mongodb://localhost:27017" yaml:"mongoDbEndpoint" split_words:"true"`
		Version         int    `default:"1"`
	} `yaml:"metaDB" split_words:"true"`

	ResourceDB struct {
		Endpoint string `default:"localhost:9090"`
	} `yaml:"resourceDB" split_words:"true"`

	Blockchain struct {
		Endpoint string `default:"http://localhost:8545" yaml:"endpoint"`
		Options  struct {
			MinConfirmations int `default:"1" yaml:"minConfirmations" split_words:"true"`
		}
		DeploymentPath string `default:"deployment.local.json" yaml:"deploymentPath" split_words:"true"`
	} `yaml:"blockchain"`

	Warehouse struct {
		DefaultStorage string `default:"local" yaml:"defaultStorage" split_words:"true"`

		Http struct {
			Timeout         time.Duration `default:"30s"`
			MaxConnsPerHost int           `default:"5" yaml:"maxConnsPerHost" split_words:"true"`
		} `yaml:"http"`

		LocalStorage struct {
			SavePath string `default:"local/warehouse" yaml:"savepath" split_words:"true"`
			Endpoint string `default:"http://localhost:80" yaml:"endpoint"`
		} `yaml:"localStorage" split_words:"true"`

		S3 struct {
			Region     string `default:"ap-northeast-1" yaml:"region"`
			Bucket     string `yaml:"bucket"`
			PathPrefix string `yaml:"prefix" split_words:"true"`
		}

		Debug struct {
			DisableUserAuthValidation bool `default:"false" yaml:"disableUserAuthValidation" split_words:"true"`
			DisableSchemaValidation   bool `default:"false" yaml:"disableSchemaValidation" split_words:"true"`
		}
	} `yaml:"warehouse"`

	Controller struct {
		AccountIds []string `yaml:"accountIds" split_words:"true"`
	} `yaml:"controller" split_words:"true"`
}

func NewConfig

func NewConfig() *Config

NewConfig returns node configurations with default value.

type Constructor

type Constructor func(backend Backend) (Service, error)

type Service

type Service interface {
	Start() error
	Stop()
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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