converge: github.com/asteris-llc/converge/resource/wait/port Index | Files

package port

import "github.com/asteris-llc/converge/resource/wait/port"

Index

Package Files

port.go preparer.go

type ConnectionCheck Uses

type ConnectionCheck interface {
    CheckConnection(host string, port int) error
}

ConnectionCheck represents a connection checker

type Port Uses

type Port struct {
    *wait.Retrier

    // the hostname
    Host string `export:"host"`

    // the TCP port
    Port int `export:"port"`

    ConnectionCheck
}

Port represents a port check

func (*Port) Apply Uses

func (p *Port) Apply(context.Context) (resource.TaskStatus, error)

Apply retries the check until it passes or returns max failure threshold

func (*Port) Check Uses

func (p *Port) Check(context.Context, resource.Renderer) (resource.TaskStatus, error)

Check if the port is open

func (*Port) CheckConnection Uses

func (p *Port) CheckConnection() error

CheckConnection attempts to see if a tcp port is open

type Preparer Uses

type Preparer struct {
    // a host name or ip address. A TCP connection will be attempted at this host
    // and the specified Port. default: localhost
    Host string `hcl:"host"`

    // the TCP port to attempt to connect to.
    Port int `hcl:"port" required:"true"`

    // the amount of time to wait in between checks. If the interval is not
    // specified, it will default to 5 seconds.
    Interval *time.Duration `hcl:"interval"`

    // the amount of time to wait before running the first check and after a
    // successful check. If no grace period is specified, no grace period will be
    // taken into account.
    GracePeriod *time.Duration `hcl:"grace_period"`

    // the maximum number of attempts before the wait fails. If the maximum number
    // of retries is not set, it will default to 5.
    MaxRetry *int `hcl:"max_retry"`
}

Preparer handles wait.query tasks

func (*Preparer) Prepare Uses

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare creates a new wait.port type

type TCPConnectionCheck Uses

type TCPConnectionCheck struct{}

TCPConnectionCheck impelements a ConnectionCheck over TCP

func (*TCPConnectionCheck) CheckConnection Uses

func (t *TCPConnectionCheck) CheckConnection(host string, port int) error

CheckConnection attempts to see if a tcp port is open

Package port imports 9 packages (graph) and is imported by 2 packages. Updated 2016-12-25. Refresh now. Tools for package owners.