nxcli: github.com/jaracil/nxcli/demos/go/sugar Index | Files | Directories

package sugar

import "github.com/jaracil/nxcli/demos/go/sugar"


Package Files

server.go sugar.go

func IsNexusErr Uses

func IsNexusErr(err error) bool

IsNexusErr returns whether the err is a *nexus.JsonRpcErr

func IsNexusErrCode Uses

func IsNexusErrCode(err error, code int) bool

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

func NewService Uses

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 Uses

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.

type Server Uses

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 Uses

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

func (*Server) AddService Uses

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

func (*Server) Serve Uses

func (s *Server) Serve() error

func (*Server) SetGracefulExitTime Uses

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

func (*Server) SetLogLevel Uses

func (s *Server) SetLogLevel(l string)

func (*Server) SetPass Uses

func (s *Server) SetPass(password string)

func (*Server) SetStatsPeriod Uses

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

func (*Server) SetUrl Uses

func (s *Server) SetUrl(url string)

func (*Server) SetUser Uses

func (s *Server) SetUser(user string)

type ServiceOpts Uses

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


logPackage log
servicePackage service is boilerplate code for making nexus services.

Package sugar imports 13 packages (graph). Updated 2016-08-12. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).