common

package
v0.0.0-...-1eeb5f6 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicUpdateManifest = "update_manifest"
	TopicHeartbeat      = "heartbeat"
	TopicEvent          = "event"
)
View Source
const (
	API_HEARTBEAT = "/heartbeat"
)

Variables

View Source
var (
	VERSION = os.Getenv("VERSION_DETAILS")
)

Functions

func BuildHeartbeatUI

func BuildHeartbeatUI(hbs []HeartbeatUI) ([]byte, error)

func Compress

func Compress(data []byte) ([]byte, error)

func Copy

func Copy(dest, src string) error

Copy file from src to dest

func CurrentScope

func CurrentScope() string

func Decompress

func Decompress(data []byte) ([]byte, error)

func DownloadAsset

func DownloadAsset(url, path string) error

func ExtractZip

func ExtractZip(path, dest string) error

func IsFile

func IsFile(path string) bool

func NativeExtractTar

func NativeExtractTar(path, dest string) error

func NativeExtractZip

func NativeExtractZip(path, dest string) error

func NativeMysql

func NativeMysql(db_user, db_host, db_port, pass, sql_path string) error

func RunCmd

func RunCmd(cmd *exec.Cmd) error

func SaveAsset

func SaveAsset(rsp *http.Response, path string) error

func SortTags

func SortTags(tags []string)

func VerifyDigest

func VerifyDigest(path string, target [16]byte) error

Types

type ByCreated

type ByCreated []Event

func (ByCreated) Len

func (by ByCreated) Len() int

func (ByCreated) Less

func (by ByCreated) Less(i, j int) bool

func (ByCreated) Swap

func (by ByCreated) Swap(i, j int)

type ByVer

type ByVer []VersionNumber

func (ByVer) Len

func (vers ByVer) Len() int

func (ByVer) Less

func (vers ByVer) Less(i, j int) bool

func (ByVer) Swap

func (vers ByVer) Swap(i, j int)

type Event

type Event struct {
	Publisher
	Ty        EventType `json:"type"`
	Component string    `json:"component,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	Version   string    `json:"version,omitempty"`
	Payload   string    `json:"payload,omitempty"`
}

func NewErrEvent

func NewErrEvent(payload string) *Event

func NewEvent

func NewEvent() *Event

func (*Event) Decode

func (e *Event) Decode(data []byte) error

func (*Event) Publish

func (e *Event) Publish() error

type EventType

type EventType string
const (
	EventTypeStarted EventType = "started"
	EventTypeUpdated EventType = "updated"
	EventTypeError   EventType = "error"
)

type Heartbeat

type Heartbeat struct {
	Publisher
	Component  string               `json:"component,omitempty"`
	CreatedAt  time.Time            `json:"created_at,omitempty"`
	Containers []types.Container    `json:"containers,omitempty"`
	Images     []types.ImageSummary `json:"images,omitempty"`
	Version    string               `json:"version,omitempty"`
	Error      string               `json:"error,omitempty"`
}

func NewUpdaterHeartbeat

func NewUpdaterHeartbeat() *Heartbeat

func (*Heartbeat) Decode

func (hb *Heartbeat) Decode(data []byte) error

func (*Heartbeat) Post

func (hb *Heartbeat) Post() error

func (*Heartbeat) Publish

func (hb *Heartbeat) Publish() error

type HeartbeatUI

type HeartbeatUI struct {
	ID         string            `json:"id,omitempty"`
	CreatedAt  time.Time         `json:"created_at,omitempty"`
	Containers []types.Container `json:"containers,omitempty"`
}

type Interface

type Interface interface {
	String() string
}

type Publisher

type Publisher interface {
	PublishEvent(data []byte) error
	PublishHeartbeat(data []byte) error
}

type Registry

type Registry struct {
	Host     string
	RegAuth  string
	AuthHost string
	Cli      http.Client
}

func NewRegistry

func NewRegistry(auth, reg, auth_svr string) *Registry

func (*Registry) GetLatestTag

func (r *Registry) GetLatestTag(name string) (string, error)

func (*Registry) GetToken

func (r *Registry) GetToken(name string) (string, error)

func (*Registry) GetUserPasswd

func (r *Registry) GetUserPasswd() (string, string)

func (*Registry) ListTags

func (r *Registry) ListTags(name string) ([]string, error)

type VersionNumber

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

func (VersionNumber) String

func (ver VersionNumber) String() string

Jump to

Keyboard shortcuts

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