go-micro: github.com/micro/go-micro/runtime Index | Files | Directories

package runtime

import "github.com/micro/go-micro/runtime"

Package runtime is a service runtime manager

Index

Package Files

default.go options.go runtime.go service.go

Variables

var (
    // DefaultRuntime is default micro runtime
    DefaultRuntime Runtime = NewRuntime()
    // DefaultName is default runtime service name
    DefaultName = "go.micro.runtime"

    ErrAlreadyExists = errors.New("already exists")
)

type CreateOption Uses

type CreateOption func(o *CreateOptions)

func CreateType Uses

func CreateType(t string) CreateOption

CreateType sets the type of service to create

func WithCommand Uses

func WithCommand(args ...string) CreateOption

WithCommand specifies the command to execute

func WithEnv Uses

func WithEnv(env []string) CreateOption

WithEnv sets the created service environment

func WithOutput Uses

func WithOutput(out io.Writer) CreateOption

WithOutput sets the arg output

func WithRetries Uses

func WithRetries(retries int) CreateOption

WithRetries sets the max retries attemps

type CreateOptions Uses

type CreateOptions struct {
    // command to execute including args
    Command []string
    // Environment to configure
    Env []string
    // Log output
    Output io.Writer
    // Type of service to create
    Type string
    // Retries before failing deploy
    Retries int
}

CreateOptions configure runtime services

type Event Uses

type Event struct {
    // Type is event type
    Type EventType
    // Timestamp is event timestamp
    Timestamp time.Time
    // Service is the name of the service
    Service string
    // Version of the build
    Version string
}

Event is notification event

type EventType Uses

type EventType int

EventType defines schedule event

const (
    // Create is emitted when a new build has been craeted
    Create EventType = iota
    // Update is emitted when a new update become available
    Update
    // Delete is emitted when a build has been deleted
    Delete
)

func (EventType) String Uses

func (t EventType) String() string

String returns human readable event type

type Option Uses

type Option func(o *Options)

func WithScheduler Uses

func WithScheduler(n Scheduler) Option

WithScheduler specifies a scheduler for updates

func WithSource Uses

func WithSource(src string) Option

WithSource sets the base image / repository

func WithType Uses

func WithType(t string) Option

WithType sets the service type to manage

type Options Uses

type Options struct {
    // Scheduler for updates
    Scheduler Scheduler
    // Service type to manage
    Type string
    // Source of the services repository
    Source string
}

Options configure runtime

type ReadOption Uses

type ReadOption func(o *ReadOptions)

func ReadService Uses

func ReadService(service string) ReadOption

ReadService returns services with the given name

func ReadType Uses

func ReadType(t string) ReadOption

ReadType returns services of the given type

func ReadVersion Uses

func ReadVersion(version string) ReadOption

ReadVersion confifgures service version

type ReadOptions Uses

type ReadOptions struct {
    // Service name
    Service string
    // Version queries services with given version
    Version string
    // Type of service
    Type string
}

ReadOptions queries runtime services

type Runtime Uses

type Runtime interface {
    // String describes runtime
    String() string
    // Init initializes runtime
    Init(...Option) error
    // Create registers a service
    Create(*Service, ...CreateOption) error
    // Read returns the service
    Read(...ReadOption) ([]*Service, error)
    // Update the service in place
    Update(*Service) error
    // Remove a service
    Delete(*Service) error
    // List the managed services
    List() ([]*Service, error)
    // Start starts the runtime
    Start() error
    // Stop shuts down the runtime
    Stop() error
}

Runtime is a service runtime manager

func NewRuntime Uses

func NewRuntime(opts ...Option) Runtime

NewRuntime creates new local runtime and returns it

type Scheduler Uses

type Scheduler interface {
    // Notify publishes schedule events
    Notify() (<-chan Event, error)
    // Close stops the scheduler
    Close() error
}

Scheduler is a runtime service scheduler

type Service Uses

type Service struct {
    // Name of the service
    Name string
    // Version of the service
    Version string
    // url location of source
    Source string
    // Metadata stores metadata
    Metadata map[string]string
}

Service is runtime service

Directories

PathSynopsis
kubernetesPackage kubernetes implements kubernetes micro runtime
local/buildPackage build builds a micro runtime package
local/build/dockerPackage docker builds docker images
local/build/goPackage golang is a go package manager
local/processPackage process executes a binary
local/process/osPackage os runs processes locally
local/sourcePackage source retrieves source code
local/source/gitPackage git provides a git source
local/source/goPackage golang is a source for Go
service
service/proto

Package runtime imports 9 packages (graph) and is imported by 26 packages. Updated 2020-02-10. Refresh now. Tools for package owners.