provider

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoreProvider

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

CoreProvider is a struct that provides all methods required by core command.

func NewCoreProvider

func NewCoreProvider(client coreapi.CoreClient, d daemon.Daemon) *CoreProvider

NewCoreProvider creates new CoreProvider.

func (*CoreProvider) Logs

func (p *CoreProvider) Logs() (io.ReadCloser, error)

Logs returns daemon logs reader.

func (*CoreProvider) Start

func (p *CoreProvider) Start() error

Start starts core daemon.

func (*CoreProvider) Status

func (p *CoreProvider) Status() (container.StatusType, error)

Status returns daemon status.

func (*CoreProvider) Stop

func (p *CoreProvider) Stop() error

Stop stops core daemon and all running services.

type DeployStatus

type DeployStatus struct {
	Message string
	Type    StatusType
}

DeployStatus represents the deployment status.

type Log

type Log struct {
	Dependency      string
	Standard, Error *chunker.Stream
}

Log keeps dependency logs of service.

type MarketplaceDeployedSource added in v0.9.0

type MarketplaceDeployedSource struct {
	Type   string `json:"type"`
	Source string `json:"source"`
}

MarketplaceDeployedSource is the information related to a deployment

type MarketplaceErrorOutput added in v0.9.0

type MarketplaceErrorOutput struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

MarketplaceErrorOutput is the output for any task that fails.

func (MarketplaceErrorOutput) Error added in v0.9.0

func (e MarketplaceErrorOutput) Error() string

type MarketplaceManifestData added in v0.9.0

type MarketplaceManifestData struct {
	Version string                         `json:"version"`
	Service MarketplaceManifestServiceData `json:"service"`
}

MarketplaceManifestData struct {

func (*MarketplaceManifestData) UnmarshalJSON added in v0.9.0

func (d *MarketplaceManifestData) UnmarshalJSON(data []byte) error

UnmarshalJSON overrides the default one to allow parsing malformed manifest data without returning error to user.

type MarketplaceManifestServiceData added in v0.9.0

type MarketplaceManifestServiceData struct {
	Definition *definition.Service       `json:"definition"`
	Readme     string                    `json:"readme,omitempty"`
	Deployment MarketplaceDeployedSource `json:"deployment"`
}

MarketplaceManifestServiceData is the data present to the manifest and sent to create a new service's version

type MarketplaceProvider added in v0.9.0

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

MarketplaceProvider is a struct that provides all methods required by service command.

func NewMarketplaceProvider added in v0.9.0

func NewMarketplaceProvider(c coreapi.CoreClient) *MarketplaceProvider

NewMarketplaceProvider creates new MarketplaceProvider.

func (*MarketplaceProvider) GetService added in v0.9.0

func (p *MarketplaceProvider) GetService(sid string) (MarketplaceService, error)

GetService executes the task get service.

func (*MarketplaceProvider) IsAuthorized added in v0.9.0

func (p *MarketplaceProvider) IsAuthorized(sid string, versionHash string, addresses []string) (bool, string, string, string, error)

IsAuthorized executes the task IsAuthorized.

func (*MarketplaceProvider) PrepareCreateServiceOffer added in v0.9.0

func (p *MarketplaceProvider) PrepareCreateServiceOffer(sid string, price string, duration string, from string) (Transaction, error)

PrepareCreateServiceOffer executes the create service offer task

func (*MarketplaceProvider) PreparePublishServiceVersion added in v0.9.0

func (p *MarketplaceProvider) PreparePublishServiceVersion(service MarketplaceManifestServiceData, from string) (Transaction, error)

PreparePublishServiceVersion executes the create service version task

func (*MarketplaceProvider) PreparePurchase added in v0.9.0

func (p *MarketplaceProvider) PreparePurchase(sid, offerIndex, from string) ([]Transaction, error)

PreparePurchase executes the purchase task

func (*MarketplaceProvider) PublishCreateServiceOffer added in v0.9.0

func (p *MarketplaceProvider) PublishCreateServiceOffer(signedTransaction string) (sid, offerIndex, price, duration string, err error)

PublishCreateServiceOffer executes the task publish service offer task

func (*MarketplaceProvider) PublishPublishServiceVersion added in v0.9.0

func (p *MarketplaceProvider) PublishPublishServiceVersion(signedTransaction string) (sid, versionHash, manifest, manifestProtocol string, err error)

PublishPublishServiceVersion executes the task publish service version task

func (*MarketplaceProvider) PublishPurchase added in v0.9.0

func (p *MarketplaceProvider) PublishPurchase(signedTransactions []string) (sid, offerIndex, purchaser, price, duration string, expire time.Time, err error)

PublishPurchase executes the task publish service version task

func (*MarketplaceProvider) UploadSource added in v0.9.0

func (p *MarketplaceProvider) UploadSource(path string) (MarketplaceDeployedSource, error)

UploadSource upload the tarball, and returns the address of the uploaded sources

type MarketplaceService added in v0.9.0

type MarketplaceService struct {
	Sid      string `json:"sid"`
	Owner    string `json:"owner"`
	Versions []struct {
		VersionHash      string                  `json:"versionHash"`
		Manifest         string                  `json:"manifest"`
		ManifestProtocol string                  `json:"manifestProtocol"`
		ManifestData     MarketplaceManifestData `json:"manifestData,omitempty"`
	} `json:"versions"`
	Offers []struct {
		OfferIndex string `json:"offerIndex"`
		Price      string `json:"price"`
		Duration   string `json:"duration"`
		Active     bool   `json:"active"`
	} `json:"offers"`
	Purchases []struct {
		Purchaser string    `json:"purchaser"`
		Expire    time.Time `json:"expire"`
	} `json:"purchases"`
}

MarketplaceService is the success output of task service exist.

type Provider

Provider is a struct that provides all methods required by any command.

func New

New creates Provider based on given CoreClient.

type ServiceProvider

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

ServiceProvider is a struct that provides all methods required by service command.

func NewServiceProvider

func NewServiceProvider(c coreapi.CoreClient, mp *MarketplaceProvider, wp *WalletProvider) *ServiceProvider

NewServiceProvider creates new ServiceProvider.

func (*ServiceProvider) ServiceByID

func (p *ServiceProvider) ServiceByID(id string) (*coreapi.Service, error)

ServiceByID finds service based on given id.

func (*ServiceProvider) ServiceDelete

func (p *ServiceProvider) ServiceDelete(deleteData bool, ids ...string) error

ServiceDelete deletes service with given ids.

func (*ServiceProvider) ServiceDeleteAll

func (p *ServiceProvider) ServiceDeleteAll(deleteData bool) error

ServiceDeleteAll deletes all services.

func (*ServiceProvider) ServiceDeploy

func (p *ServiceProvider) ServiceDeploy(path string, env map[string]string, statuses chan DeployStatus) (sid string, hash string, validationError, err error)

ServiceDeploy deploys service from given path.

func (*ServiceProvider) ServiceExecuteTask

func (p *ServiceProvider) ServiceExecuteTask(id, taskKey, inputData string, tags []string) (string, error)

ServiceExecuteTask executes task on given service.

func (*ServiceProvider) ServiceGenerateDocs

func (p *ServiceProvider) ServiceGenerateDocs(path string) error

ServiceGenerateDocs creates docs in given path.

func (*ServiceProvider) ServiceInitDownloadTemplate

func (p *ServiceProvider) ServiceInitDownloadTemplate(t *servicetemplate.Template, dst string) error

ServiceInitDownloadTemplate download given service template.

func (*ServiceProvider) ServiceInitTemplateList

func (p *ServiceProvider) ServiceInitTemplateList() ([]*servicetemplate.Template, error)

ServiceInitTemplateList downloads services templates list from awesome github repo.

func (*ServiceProvider) ServiceList

func (p *ServiceProvider) ServiceList() ([]*coreapi.Service, error)

ServiceList lists all services.

func (*ServiceProvider) ServiceListenEvents

func (p *ServiceProvider) ServiceListenEvents(id, eventFilter string) (chan *coreapi.EventData, chan error, error)

ServiceListenEvents returns a channel with event data streaming..

func (*ServiceProvider) ServiceListenResults

func (p *ServiceProvider) ServiceListenResults(id, taskFilter, outputFilter string, tagFilters []string) (chan *coreapi.ResultData, chan error, error)

ServiceListenResults returns a channel with event results streaming..

func (*ServiceProvider) ServiceLogs

func (p *ServiceProvider) ServiceLogs(id string, dependencies ...string) (logs []*Log, close func(), errC chan error, err error)

ServiceLogs returns logs reader for all service dependencies.

func (*ServiceProvider) ServiceStart

func (p *ServiceProvider) ServiceStart(id string) error

ServiceStart starts a service.

func (*ServiceProvider) ServiceStop

func (p *ServiceProvider) ServiceStop(id string) error

ServiceStop stops a service.

func (*ServiceProvider) ServiceValidate

func (p *ServiceProvider) ServiceValidate(path string) (string, error)

ServiceValidate validates a service configuration and Dockerfile.

type StatusType

type StatusType int

StatusType indicates the type of status message.

const (

	// Running indicates that status message belongs to a continuous state.
	Running StatusType

	// DonePositive indicates that status message belongs to a positive noncontinuous state.
	DonePositive

	// DoneNegative indicates that status message belongs to a negative noncontinuous state.
	DoneNegative
)

type Transaction added in v0.9.0

type Transaction struct {
	ChainID  int64  `json:"chainID"`
	Nonce    uint64 `json:"nonce"`
	To       string `json:"to"`
	Value    string `json:"value"`
	Gas      uint64 `json:"gas"`
	GasPrice string `json:"gasPrice"`
	Data     string `json:"data"`
}

Transaction represents created transaction.

type TransactionReceipt added in v0.9.0

type TransactionReceipt struct {
	Receipt struct {
		BlockNumber      uint   `json:"blockNumber"`
		From             string `json:"from"`
		GasUsed          uint   `json:"gasUsed"`
		Status           bool   `json:"status"`
		To               string `json:"to"`
		TransactionHash  string `json:"transactionHash"`
		TransactionIndex uint   `json:"transactionIndex"`
	} `json:"receipt"`
}

TransactionReceipt is the success output of task send signed transaction.

type WalletEncryptedKeyJSONV3 added in v0.9.0

type WalletEncryptedKeyJSONV3 struct {
	Address string      `json:"address"`
	Crypto  interface{} `json:"crypto"`
	ID      string      `json:"id"`
	Version int         `json:"version"`
}

WalletEncryptedKeyJSONV3 represents an Ethereum JSON v3 encrypted wallet

type WalletProvider added in v0.9.0

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

WalletProvider is a struct that provides all methods required by wallet command.

func NewWalletProvider added in v0.9.0

func NewWalletProvider(c coreapi.CoreClient) *WalletProvider

NewWalletProvider creates new WalletProvider.

func (*WalletProvider) Create added in v0.9.0

func (p *WalletProvider) Create(passphrase string) (string, error)

Create creates a new account in the wallet

func (*WalletProvider) Delete added in v0.9.0

func (p *WalletProvider) Delete(address string, passphrase string) (string, error)

Delete removes an account from the wallet

func (*WalletProvider) Export added in v0.9.0

func (p *WalletProvider) Export(address string, passphrase string) (WalletEncryptedKeyJSONV3, error)

Export exports an account

func (*WalletProvider) Import added in v0.9.0

func (p *WalletProvider) Import(account WalletEncryptedKeyJSONV3, passphrase string) (string, error)

Import imports an account into the wallet

func (*WalletProvider) ImportFromPrivateKey added in v0.9.0

func (p *WalletProvider) ImportFromPrivateKey(privateKey string, passphrase string) (string, error)

ImportFromPrivateKey imports an account from a private key

func (*WalletProvider) List added in v0.9.0

func (p *WalletProvider) List() ([]string, error)

List return the accounts of this wallet

func (*WalletProvider) Sign added in v0.9.0

func (p *WalletProvider) Sign(address string, passphrase string, transaction Transaction) (string, error)

Sign signs a transaction

Directories

Path Synopsis
Code generated by go-bindata.
Code generated by go-bindata.

Jump to

Keyboard shortcuts

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