miner

package
v0.0.0-...-626ce36 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2017 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrListenerClosed is returned to clients and servers is the listener closed
	ErrListenerClosed = errors.New("inmemory listener closed")
)

Functions

func NewReverseListener

func NewReverseListener(backlog int) *reverseListener

New returns inmemory Listener

Types

type BackoffTimer

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

BackoffTimer implementation

func NewBackoffTimer

func NewBackoffTimer(sleep, maxsleep time.Duration) *BackoffTimer

NewBackoffTimer implementations one direction backoff policy

func (*BackoffTimer) C

func (b *BackoffTimer) C() <-chan time.Time

C resets Timer and returns Timer.C

func (*BackoffTimer) Stop

func (b *BackoffTimer) Stop() bool

Stop frees the Timer

type ContainterInfo

type ContainterInfo struct {
	ID    string
	Ports nat.PortMap
}

type Description

type Description struct {
	Registry string
	Image    string
}

Description for a target application name, version, hash etc.

type Key

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

func (*Key) Generate

func (key *Key) Generate()

func (*Key) Load

func (key *Key) Load() bool

func (*Key) Save

func (key *Key) Save() bool

type Miner

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

Miner holds information about jobs, make orders to Observer and communicates with Hub

func New

func New(ctx context.Context, hubaddress string) (*Miner, error)

New returns new Miner

func (*Miner) Close

func (m *Miner) Close()

Close disposes all resources related to the Miner

func (*Miner) Handshake

Handshake reserves for the future usage

func (*Miner) Ping

func (m *Miner) Ping(ctx context.Context, _ *pb.PingRequest) (*pb.PingReply, error)

Ping works as Healthcheck for the Hub

func (*Miner) Serve

func (m *Miner) Serve() error

Serve starts discovery of Hubs, accepts incoming connections from a Hub

func (*Miner) Start

func (m *Miner) Start(ctx context.Context, request *pb.StartRequest) (*pb.StartReply, error)

Start request from Hub makes Miner start a container

func (*Miner) Stop

func (m *Miner) Stop(ctx context.Context, request *pb.StopRequest) (*pb.StopReply, error)

Stop request forces to kill container

type Overseer

type Overseer interface {
	Spool(ctx context.Context, d Description) error
	Spawn(ctx context.Context, d Description) (ContainterInfo, error)
	Stop(ctx context.Context, containerID string) error
	Close() error
}

Overseer watches all miners' applications

func NewOverseer

func NewOverseer(ctx context.Context) (Overseer, error)

NewOverseer creates new overseer

Jump to

Keyboard shortcuts

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