runner

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(server Server, deallocFunc func() error, opts ...Option) error

Run

func RunServer added in v0.1.1

func RunServer(server Server, opts ...Option) error

Types

type Config

type Config struct {
	ListenAddr   string
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	Context      context.Context
}

func (*Config) Init

func (c *Config) Init() *Config

func (*Config) String

func (c *Config) String() string

func (*Config) WithOptions

func (c *Config) WithOptions(opts ...Option) *Config

type EmptyServer added in v0.1.1

type EmptyServer struct {
}

func (*EmptyServer) Run added in v0.1.1

func (s *EmptyServer) Run(cfg *Config) error

func (*EmptyServer) Shutdown added in v0.1.1

func (s *EmptyServer) Shutdown(ctx context.Context) error

type GrpcServer

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

func NewGrpcServer

func NewGrpcServer() *GrpcServer

func (*GrpcServer) Run

func (s *GrpcServer) Run(c *Config) error

func (*GrpcServer) RunAfter

func (s *GrpcServer) RunAfter(fn func(s *grpc.Server) error)

func (*GrpcServer) Server

func (s *GrpcServer) Server() *grpc.Server

func (*GrpcServer) Shutdown

func (s *GrpcServer) Shutdown(ctx context.Context) error

type HttpServer

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

func NewHttpServer

func NewHttpServer(handler http.Handler) *HttpServer

func (*HttpServer) Run

func (s *HttpServer) Run(c *Config) error

Run

func (*HttpServer) Shutdown

func (s *HttpServer) Shutdown(ctx context.Context) error

Shutdown

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithContext

func WithContext(ctx context.Context) Option

func WithListenAddr

func WithListenAddr(addr string) Option

func WithReadTimeout

func WithReadTimeout(timeout time.Duration) Option

func WithWriteTimeout

func WithWriteTimeout(timeout time.Duration) Option

type Server

type Server interface {
	Run(*Config) error
	Shutdown(context.Context) error
}

type TaskServer

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

func NewTaskServer

func NewTaskServer() *TaskServer

func (*TaskServer) AddCronFunc

func (s *TaskServer) AddCronFunc(spec string, fn func()) error

func (*TaskServer) AddOnceTimeAfterFunc added in v0.2.7

func (s *TaskServer) AddOnceTimeAfterFunc(d time.Duration, fn func(ctx context.Context)) error

AddOnceTimeAfterFunc after d, once exec

func (*TaskServer) AddTickerTimeAfterFunc added in v0.2.7

func (s *TaskServer) AddTickerTimeAfterFunc(d time.Duration, fn func(ctx context.Context)) error

AddTickerTimeAfterFunc ticker d, loop exec

func (*TaskServer) AddTimeAfterFunc

func (s *TaskServer) AddTimeAfterFunc(d time.Duration, fn func(ctx context.Context)) error

you can use AddTickerTimeAfterFunc replace this Deprecated

func (*TaskServer) Run

func (s *TaskServer) Run(c *Config) error

func (*TaskServer) Shutdown

func (s *TaskServer) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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