cmd

package
v0.0.0-...-537fcec Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package cmd is the front-end interface for the application as a command-line utility.

Authenticator

Authenticator prompts the user for their password, which is used to unlock their keystore file to interact with the Ethereum blockchain. Since multiple keystore files can exist at the configured directory, the Authenticator will try the password on all keystore files present.

Client

Client is how the application is invoked from the command line. When you run the binary, for example `./chainlink n`, client.RunNode is called to start the Chainlink core. Similarly, running `./chainlink j` returns information on all jobs in the node, and `./chainlink s` with another argument as a JobID gives information specific to that job.

Renderer

Renderer helps format and display data (based on the kind of data it is) to the command line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppFactory

type AppFactory interface {
	NewApplication(strpkg.Config) services.Application
}

AppFactory implements the NewApplication method.

type Authenticator

type Authenticator interface {
	Authenticate(*store.Store, string)
}

Authenticator implements the Authenticate method for the store and a password string.

type ChainlinkAppFactory

type ChainlinkAppFactory struct{}

ChainlinkAppFactory is used to create a new Application.

func (ChainlinkAppFactory) NewApplication

func (n ChainlinkAppFactory) NewApplication(config strpkg.Config) services.Application

NewApplication returns a new instance of the node with the given config.

type ChainlinkRunner

type ChainlinkRunner struct{}

ChainlinkRunner is used to run the node application.

func (ChainlinkRunner) Run

Run sets the log level based on config and starts the web router to listen for input and return data.

type Client

type Client struct {
	Renderer
	Config     strpkg.Config
	AppFactory AppFactory
	Auth       Authenticator
	Runner     Runner
}

Client is the shell for the node. It has fields for the Renderer, Config, AppFactory (the services application), Authenticator, and Runner.

func (*Client) GetJobSpecs

func (cli *Client) GetJobSpecs(c *clipkg.Context) error

GetJobSpecs returns all job specs.

func (*Client) RunNode

func (cli *Client) RunNode(c *clipkg.Context) error

RunNode starts the Chainlink core.

func (*Client) ShowJobSpec

func (cli *Client) ShowJobSpec(c *clipkg.Context) error

ShowJobSpec returns the status of the given JobID.

type PasswordPrompter

type PasswordPrompter struct{}

PasswordPrompter is used to display and read input from the user.

func (PasswordPrompter) Prompt

func (pp PasswordPrompter) Prompt(prompt string) string

Prompt displays the prompt for the user to enter the password and reads their input.

type Prompter

type Prompter interface {
	Prompt(string) string
}

Prompter implements the Prompt function to be used to display at the console.

type Renderer

type Renderer interface {
	Render(interface{}) error
}

Renderer implements the Render method.

type RendererJSON

type RendererJSON struct {
	io.Writer
}

RendererJSON is used to render JSON data.

func (RendererJSON) Render

func (rj RendererJSON) Render(v interface{}) error

Render writes the given input as a JSON string.

type RendererTable

type RendererTable struct {
	io.Writer
}

RendererTable is used for data to be rendered as a table.

func (RendererTable) Render

func (rt RendererTable) Render(v interface{}) error

Render returns a formatted table of text for a given Job or presenter and relevant information.

type Runner

type Runner interface {
	Run(services.Application) error
}

Runner implements the Run method.

type TerminalAuthenticator

type TerminalAuthenticator struct {
	Prompter Prompter
	Exiter   func(int)
}

TerminalAuthenticator contains fields for prompting the user and an exit code.

func (TerminalAuthenticator) Authenticate

func (auth TerminalAuthenticator) Authenticate(store *store.Store, pwd string)

Authenticate checks to see if there are accounts present in the KeyStore, and if there are none, a new account will be created by prompting for a password. If there are accounts present, the account which is unlocked by the given password will be used.

Jump to

Keyboard shortcuts

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