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

package micro

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

Package micro is a pluggable framework for microservices

Index

Package Files

function.go micro.go options.go publisher.go service.go

Variables

var (
    HeaderPrefix = "Micro-"
)

func NewContext Uses

func NewContext(ctx context.Context, s Service) context.Context

NewContext returns a new Context with the Service embedded within it.

func RegisterHandler Uses

func RegisterHandler(s server.Server, h interface{}, opts ...server.HandlerOption) error

RegisterHandler is syntactic sugar for registering a handler

func RegisterSubscriber Uses

func RegisterSubscriber(topic string, s server.Server, h interface{}, opts ...server.SubscriberOption) error

RegisterSubscriber is syntactic sugar for registering a subscriber

type Function Uses

type Function interface {
    // Inherits Service interface
    Service
    // Done signals to complete execution
    Done() error
    // Handle registers an RPC handler
    Handle(v interface{}) error
    // Subscribe registers a subscriber
    Subscribe(topic string, v interface{}) error
}

Function is a one time executing Service

func NewFunction Uses

func NewFunction(opts ...Option) Function

NewFunction returns a new Function for a one time executing Service

type Option Uses

type Option func(*Options)

func Action Uses

func Action(a func(*cli.Context)) Option

func Address Uses

func Address(addr string) Option

Address sets the address of the server

func AfterStart Uses

func AfterStart(fn func() error) Option

func AfterStop Uses

func AfterStop(fn func() error) Option

func BeforeStart Uses

func BeforeStart(fn func() error) Option

func BeforeStop Uses

func BeforeStop(fn func() error) Option

func Broker Uses

func Broker(b broker.Broker) Option

func Client Uses

func Client(c client.Client) Option

func Cmd Uses

func Cmd(c cmd.Cmd) Option

func Context Uses

func Context(ctx context.Context) Option

Context specifies a context for the service. Can be used to signal shutdown of the service. Can be used for extra option values.

func Flags Uses

func Flags(flags ...cli.Flag) Option

func HandleSignal Uses

func HandleSignal(b bool) Option

HandleSignal toggles automatic installation of the signal handler that traps TERM, INT, and QUIT. Users of this feature to disable the signal handler, should control liveness of the service through the context.

func Metadata Uses

func Metadata(md map[string]string) Option

Metadata associated with the service

func Name Uses

func Name(n string) Option

Name of the service

func RegisterInterval Uses

func RegisterInterval(t time.Duration) Option

RegisterInterval specifies the interval on which to re-register

func RegisterTTL Uses

func RegisterTTL(t time.Duration) Option

RegisterTTL specifies the TTL to use when registering the service

func Registry Uses

func Registry(r registry.Registry) Option

Registry sets the registry for the service and the underlying components

func Selector Uses

func Selector(s selector.Selector) Option

Selector sets the selector for the service client

func Server Uses

func Server(s server.Server) Option

func Transport Uses

func Transport(t transport.Transport) Option

Transport sets the transport for the service and the underlying components

func Version Uses

func Version(v string) Option

Version of the service

func WrapCall Uses

func WrapCall(w ...client.CallWrapper) Option

WrapCall is a convenience method for wrapping a Client CallFunc

func WrapClient Uses

func WrapClient(w ...client.Wrapper) Option

WrapClient is a convenience method for wrapping a Client with some middleware component. A list of wrappers can be provided. Wrappers are applied in reverse order so the last is executed first.

func WrapHandler Uses

func WrapHandler(w ...server.HandlerWrapper) Option

WrapHandler adds a handler Wrapper to a list of options passed into the server

func WrapSubscriber Uses

func WrapSubscriber(w ...server.SubscriberWrapper) Option

WrapSubscriber adds a subscriber Wrapper to a list of options passed into the server

type Options Uses

type Options struct {
    Broker    broker.Broker
    Cmd       cmd.Cmd
    Client    client.Client
    Server    server.Server
    Registry  registry.Registry
    Transport transport.Transport

    // Before and After funcs
    BeforeStart []func() error
    BeforeStop  []func() error
    AfterStart  []func() error
    AfterStop   []func() error

    // Other options for implementations of the interface
    // can be stored in a context
    Context context.Context

    Signal bool
}

type Publisher Uses

type Publisher interface {
    Publish(ctx context.Context, msg interface{}, opts ...client.PublishOption) error
}

Publisher is syntactic sugar for publishing

func NewPublisher Uses

func NewPublisher(topic string, c client.Client) Publisher

NewPublisher returns a new Publisher

type Service Uses

type Service interface {
    // The service name
    Name() string
    // Init initialises options
    Init(...Option)
    // Options returns the current options
    Options() Options
    // Client is used to call services
    Client() client.Client
    // Server is for handling requests and events
    Server() server.Server
    // Run the service
    Run() error
    // The service implementation
    String() string
}

Service is an interface that wraps the lower level libraries within go-micro. Its a convenience method for building and initialising services.

func FromContext Uses

func FromContext(ctx context.Context) (Service, bool)

FromContext retrieves a Service from the Context.

func NewService Uses

func NewService(opts ...Option) Service

NewService creates and returns a new Service based on the packages within.

Directories

PathSynopsis
agentPackage agent provides an interface for building robots
agent/commandPackage command is an interface for defining bot commands
agent/inputPackage input is an interface for bot inputs
agent/input/discord
agent/input/slack
agent/input/telegram
agent/protoPackage go_micro_bot is a generated protocol buffer package.
api
api/handlerPackage handler provides http handlers
api/handler/apiPackage api provides an http-rpc handler which provides the entire http request over rpc
api/handler/brokerPackage broker provides a go-micro/broker handler
api/handler/cloudeventsPackage cloudevents provides a cloudevents handler publishing the event using the go-micro/client
api/handler/eventPackage event provides a handler which publishes an event
api/handler/filePackage file serves file relative to the current directory
api/handler/httpPackage http is a http reverse proxy handler
api/handler/registryPackage registry is a go-micro/registry handler
api/handler/rpcPackage rpc is a go-micro rpc handler.
api/handler/udpPackage udp reads and write from a udp connection
api/handler/unixPackage unix reads from a unix socket expecting it to be in /tmp/path
api/handler/webPackage web contains the web handler including websocket support
api/internal/proto
api/proto
api/resolverPackage resolver resolves a http request to an endpoint
api/resolver/grpcPackage grpc resolves a grpc service like /greeter.Say/Hello to greeter service
api/resolver/hostPackage host resolves using http host
api/resolver/microPackage micro provides a micro rpc resolver which prefixes a namespace
api/resolver/pathPackage path resolves using http path
api/resolver/vpathPackage vpath resolves using http path and recognised versioned urls
api/routerPackage router provides api service routing
api/router/registryPackage registry provides a dynamic api service router
api/serverPackage server provides an API gateway server which handles inbound requests
api/server/acmePackage acme abstracts away various ACME libraries
api/server/acme/autocertPackage autocert is the ACME provider from golang.org/x/crypto/acme/autocert This provider does not take any config.
api/server/acme/certmagicPackage certmagic is the ACME provider from github.com/mholt/certmagic
api/server/httpPackage http provides a http server with features; acme, cors, etc
brokerPackage broker is an interface used for asynchronous messaging
broker/httpPackage http provides a http based message broker
broker/memoryPackage memory provides a memory broker
broker/natsPackage nats provides a NATS broker
broker/servicePackage service provides the broker service client
broker/service/handler
broker/service/proto
clientPackage client is an interface for an RPC client
client/grpcPackage grpc provides a gRPC client
client/mockPackage mock provides a mock client for testing
client/mucpPackage mucp provides an mucp client
client/poolPackage pool is a connection pool
client/proto
client/selectorPackage selector is a way to pick a list of service nodes
client/selector/dnsPackage dns provides a dns SRV selector
client/selector/registryPackage registry uses the go-micro registry for selection
client/selector/routerPackage router is a network/router selector
client/selector/staticPackage static provides a static resolver which returns the name/ip passed in without any change
codecPackage codec is an interface for encoding messages
codec/bytesPackage bytes provides a bytes codec which does not encode or decode anything
codec/grpcPackage grpc provides a grpc codec
codec/jsonPackage json provides a json codec
codec/jsonrpcPackage jsonrpc provides a json-rpc 1.0 codec
codec/protoPackage proto provides a proto codec
codec/protorpcPackage proto is a generated protocol buffer package.
codec/textPackage text reads any text/* content-type
configPackage config is an interface for dynamic configuration.
config/cmdPackage cmd is an interface for parsing the command line
config/encoderPackage encoder handles source encoding formats
config/encoder/hcl
config/encoder/json
config/encoder/toml
config/encoder/xml
config/encoder/yaml
config/loaderpackage loader manages loading from multiple sources
config/loader/memory
config/optionsPackage options provides a way to initialise options
config/readerPackage reader parses change sets and provides config values
config/reader/json
config/sourcePackage source is the interface for sources
config/source/cli
config/source/env
config/source/etcd
config/source/filePackage file is a file source.
config/source/flag
config/source/memoryPackage memory is a memory source
debug/bufferPackage buffer provides a simple ring buffer for storing local data
debug/handler
debug/logPackage log provides debug logging
debug/profilePackage profile is for profilers
debug/profile/pprofPackage pprof provides a pprof profiler
debug/proto
debug/service
debug/service/handlerPacjage handler implements service debug handler
debug/service/proto
errorsPackage errors provides a way to return detailed information for an RPC request error.
metadataPackage metadata is a way of defining message headers
monitorPackage monitor monitors service health
networkPackage network is for creating internetworks
network/proto
network/resolverPackage resolver resolves network names to addresses
network/resolver/dnsPackage dns resolves names to dns records
network/resolver/dnssrvPackage dns srv resolves names to dns srv records
network/resolver/httpPackage http resolves names to network addresses using a http request
network/resolver/registryPackage registry resolves names using the go-micro registry
network/resolver/staticPackage static is a static resolver
network/service/handlerPackage handler implements network RPC handler
pluginPackage plugin provides the ability to load plugins
proxyPackage proxy is a transparent proxy built on the go-micro/server
proxy/grpcPackage grpc transparently forwards the grpc protocol using a go-micro client.
proxy/httpPackage http provides a micro rpc to http proxy
proxy/mucpPackage mucp transparently forwards the incoming request using a go-micro client.
registryPackage mdns is a multicast dns registry
registry/cachePackage cache provides a registry cache
registry/etcdPackage etcd provides an etcd service registry
registry/mdnsPackage mdns provides a multicast dns registry
registry/memoryPackage memory provides an in-memory registry
registry/servicePackage service uses the registry service
registry/service/handler
registry/service/proto
routerPackage router provides a network routing control plane
router/handler
router/proto
router/service
runtimePackage runtime is a service runtime manager
runtime/buildPackage build builds a micro runtime package
runtime/build/dockerPackage docker builds docker images
runtime/build/goPackage golang is a go package manager
runtime/kubernetesPackage kubernetes implements kubernetes micro runtime
runtime/kubernetes/client
runtime/kubernetes/client/api
runtime/kubernetes/client/watch
runtime/package/dockerPackage docker builds docker images
runtime/package/goPackage golang is a go package manager
runtime/processPackage process executes a binary
runtime/process/osPackage os runs processes locally
runtime/proto
runtime/service/handler
runtime/service/proto
runtime/sourcePackage source retrieves source code
runtime/source/gitPackage git provides a git source
runtime/source/goPackage golang is a source for Go
serverPackage server is an interface for a micro server
server/grpcPackage grpc provides a grpc server
server/grpc/proto
server/mock
server/mucpPackage mucp provides an mucp server
server/proto
servicePackage service encapsulates the client, server and other interfaces to provide a complete micro service.
service/grpc
service/grpc/proto
service/mucpPackage mucp initialises a mucp service
storePackage store is an interface for distribute data storage.
store/cloudflarePackage cloudflare is a store implementation backed by cloudflare workers kv Note that the cloudflare workers KV API is eventually consistent.
store/etcdPackage etcd is an etcd v3 implementation of kv
store/memoryPackage memory is a in-memory store store
store/mock
store/postgresqlPackage postgresql implements a micro Store backed by sql
store/servicePackage service implements the store service interface
store/service/handler
store/service/proto
syncPackage sync is a distributed synchronization framework
sync/eventPackage event provides a distributed log interface
sync/leaderPackage leader provides leader election
sync/leader/etcd
sync/lockPackage lock provides distributed locking
sync/lock/etcdPackage etcd is an etcd implementation of lock
sync/lock/httpPackage http adds a http lock implementation
sync/lock/http/serverPackage server implements the sync http server
sync/lock/memoryPackage memoy provides a sync.Mutex implementation of the lock for local use
sync/taskPackage task provides an interface for distributed jobs
sync/task/brokerPackage broker provides a distributed task manager built on the micro broker
sync/task/localPackage local provides a local task runner
sync/timePackage time provides clock synchronization
sync/time/localPackage local provides a local clock
sync/time/ntpPackage ntp provides ntp synchronized time
transportPackage transport is an interface for synchronous connection based communication
transport/grpcPackage grpc provides a grpc transport
transport/grpc/proto
transport/httpPackage http returns a http2 transport using net/http
transport/memoryPackage memory is an in-memory transport
transport/quicPackage quic provides a QUIC based transport
tunnelPackage tunnel provides gre network tunnelling
tunnel/brokerPackage broker is a tunnel broker
tunnel/transportPackage transport provides a tunnel transport
util/addr
util/backoffPackage backoff provides backoff functionality
util/buf
util/ctx
util/file
util/grpc
util/http
util/ioPackage io is for io management
util/logPackage log is a global internal logger
util/muxPackage mux provides proxy muxing
util/net
util/socketPackage socket provides a pseudo socket
util/test
util/tls
util/wrapper
webPackage web provides web based micro services

Package micro imports 21 packages (graph) and is imported by 510 packages. Updated 2019-12-05. Refresh now. Tools for package owners.