sugar

package
v0.0.0-...-d1034c5 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2016 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNexusErr

func IsNexusErr(err error) bool

IsNexusErr returns whether the err is a *nexus.JsonRpcErr

func IsNexusErrCode

func IsNexusErrCode(err error, code int) bool

IsNexusErrCode returns whether the err is a *nexus.JsonRpcErr and matches the *nexus.JsonRpcErr.Cod

func NewService

func NewService(server string, prefix string, opts *ServiceOpts) *service.Service

NewService creates a new nexus service If passed ServiceOpts is nil the defaults are 1 pull, an hour of pullTimeout and runtime.NumCPU() maxThreads Debug output is disabled by deafult StatsPeriod defaults to 5 minutes GracefulExitTime defaults to 20 seconds

func ReplyToWrapper

func ReplyToWrapper(f func(*nexus.Task) (interface{}, *nexus.JsonRpcErr)) func(*nexus.Task) (interface{}, *nexus.JsonRpcErr)

ReplyToWrapper is a wrapper for methods If a replyTo map parameter is set with a type parameter (with "pipe" or "service" values) and a path parameter with the service path or pipeId to respond to, the usual SendError/SendResult pattern will be skipped and the answer will go to the pipe or service specified after doing an Accept() to the task.

Types

type Server

type Server struct {
	Server           string
	User             string
	Password         string
	Pulls            int
	PullTimeout      time.Duration
	MaxThreads       int
	StatsPeriod      time.Duration
	GracefulExitTime time.Duration
	LogLevel         string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(server string, opts *ServiceOpts) *Server

func (*Server) AddService

func (s *Server) AddService(name string, prefix string, opts *ServiceOpts) *service.Service

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) SetGracefulExitTime

func (s *Server) SetGracefulExitTime(t time.Duration)

func (*Server) SetLogLevel

func (s *Server) SetLogLevel(l string)

func (*Server) SetPass

func (s *Server) SetPass(password string)

func (*Server) SetStatsPeriod

func (s *Server) SetStatsPeriod(t time.Duration)

func (*Server) SetUrl

func (s *Server) SetUrl(url string)

func (*Server) SetUser

func (s *Server) SetUser(user string)

type ServiceOpts

type ServiceOpts struct {
	Pulls       int
	PullTimeout time.Duration
	MaxThreads  int
}

Directories

Path Synopsis
demos
Package log
Package log
Package service is boilerplate code for making nexus services.
Package service is boilerplate code for making nexus services.

Jump to

Keyboard shortcuts

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