linna

package
v0.0.0-...-7a25296 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Shutdown = func() {}

退出程序

Functions

func NewRuntimeGoContext

func NewRuntimeGoContext(ctx context.Context, values *RuntimeGoContextValues) context.Context

func NewRuntimeGoLogger

func NewRuntimeGoLogger(logger *zap.Logger) nanaruntime.Logger

func NewWebsocketAcceptor

func NewWebsocketAcceptor(c Configuration, metric metrics.Metrics) func(http.ResponseWriter, *http.Request)

func NodeToHash

func NodeToHash(node string) [6]byte

func Serve

func Serve(ctx context.Context, c Configuration) error

开启linna服务

Types

type ApiConfiguration

type ApiConfiguration struct {
	ServerKey            string            `yaml:"server_key" json:"server_key" usage:"Server key to use to establish a connection to the server."`
	Domain               string            `yaml:"domain" json:"domain" usage:"The domain for services address."`
	Port                 int               ``                  /* 154-byte string literal not displayed */
	Address              string            ``                  /* 156-byte string literal not displayed */
	Protocol             string            ``                  /* 198-byte string literal not displayed */
	MaxMessageSizeBytes  int64             ``                  /* 186-byte string literal not displayed */
	MaxRequestSizeBytes  int64             ``                  /* 180-byte string literal not displayed */
	ReadBufferSizeBytes  int               ``                  /* 136-byte string literal not displayed */
	WriteBufferSizeBytes int               ``                  /* 139-byte string literal not displayed */
	ReadTimeoutMs        int               ``                  /* 145-byte string literal not displayed */
	WriteTimeoutMs       int               ``                  /* 157-byte string literal not displayed */
	IdleTimeoutMs        int               ``                  /* 178-byte string literal not displayed */
	WriteWaitMs          int               ``                  /* 156-byte string literal not displayed */
	PongWaitMs           int               ``                  /* 156-byte string literal not displayed */
	PingPeriodMs         int               ``                  /* 204-byte string literal not displayed */
	PingBackoffThreshold int               ``                  /* 293-byte string literal not displayed */
	OutgoingQueueSize    int               ``                  /* 245-byte string literal not displayed */
	SSLCertificate       string            ``                  /* 192-byte string literal not displayed */
	SSLPrivateKey        string            ``                  /* 192-byte string literal not displayed */
	CertPEMBlock         []byte            `yaml:"-" json:"-"` // Created by fully reading the file contents of SSLCertificate, not set from input args directly.
	KeyPEMBlock          []byte            `yaml:"-" json:"-"` // Created by fully reading the file contents of SSLPrivateKey, not set from input args directly.
	TLSCert              []tls.Certificate `yaml:"-" json:"-"` // Created by processing CertPEMBlock and KeyPEMBlock, not set from input args directly.
}

func NewApiConfiguration

func NewApiConfiguration() ApiConfiguration

func (*ApiConfiguration) Check

func (c *ApiConfiguration) Check(log *zap.Logger) error

type ApiServer

type ApiServer struct {
	pb.UnimplementedLinnaServer
	// contains filtered or unexported fields
}

func NewApiServer

func NewApiServer(log *zap.Logger, c Configuration, m metrics.Metrics, r *Runtime) *ApiServer

func (*ApiServer) RpcFunc

func (s *ApiServer) RpcFunc(ctx context.Context, in *api.Rpc) (*api.Rpc, error)

func (*ApiServer) Serve

func (s *ApiServer) Serve() *ApiServer

func (*ApiServer) SessionRefresh

func (s *ApiServer) SessionRefresh(ctx context.Context, in *api.SessionRefreshRequest) (*api.Session, error)

func (*ApiServer) Stop

func (s *ApiServer) Stop()

type Configuration

type Configuration struct {
	Name        string                `yaml:"name" json:"name" usage:"Linna server’s node name - must be unique."`
	Config      []string              `yaml:"config" json:"config" usage:"The absolute file path to configuration YAML file."`
	Datadir     string                `yaml:"data_dir" json:"data_dir" usage:"An absolute path to a writeable folder where Linna will store its data."`
	Logger      logger.Configuration  `yaml:"log" json:"log" usage:"Logger levels and output."`
	Api         ApiConfiguration      `yaml:"api" json:"api" usage:"api server."`
	Metrics     metrics.Configuration `yaml:"metrics" json:"metrics" usage:"Metrics settings."`
	Runtime     RuntimeConfiguration  `yaml:"runtime" json:"runtime" usage:"runtime settings."`
	Cluster     cluster.Configuration `yaml:"cluster" json:"cluster" usage:"cluster settings."`
	CurrentPath string
	// contains filtered or unexported fields
}

Configuration 配置

func NewConfiguration

func NewConfiguration(log *zap.Logger) *Configuration

func ParseArgs

func ParseArgs(log *zap.Logger, v, commitid, buildAt string, args []string) *Configuration

ParseArgs 参数解析

func (*Configuration) Check

func (c *Configuration) Check(log *zap.Logger) error

func (*Configuration) Parse

func (c *Configuration) Parse() error

type Runtime

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

运行时

func NewRuntime

func NewRuntime(ctx context.Context, log *zap.Logger, c Configuration) (*Runtime, error)

func (*Runtime) Rpc

func (r *Runtime) Rpc(id string) (RuntimeRpcFunction, bool)

type RuntimeAfterRtFunction

type RuntimeAfterRtFunction func(ctx context.Context, rpcValues *RuntimeRpcValues, out, in *rtapi.Envelope) error

type RuntimeBeforeRtFunction

type RuntimeBeforeRtFunction func(ctx context.Context, rpcValues *RuntimeRpcValues, in *rtapi.Envelope) (*rtapi.Envelope, error)

type RuntimeConfiguration

type RuntimeConfiguration struct {
	Environment map[string]string `yaml:"-" json:"-"`
	Env         []string          `yaml:"env" json:"env" usage:"Values to pass into Runtime as environment variables."`
	Path        string            `yaml:"path" json:"path" usage:"Path for the server to scan for Go library files."`
	HTTPKey     string            `yaml:"http_key" json:"http_key" usage:"Runtime HTTP Invocation key."`
}

运行时配置

func NewRuntimeConfiguration

func NewRuntimeConfiguration() RuntimeConfiguration

func (*RuntimeConfiguration) Check

func (c *RuntimeConfiguration) Check(log *zap.Logger) error

type RuntimeGo

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

func NewRuntimeGo

func NewRuntimeGo(ctx context.Context, log *zap.Logger, c RuntimeConfiguration, paths ...string) (*RuntimeGo, error)

func (*RuntimeGo) GetInitializer

func (r *RuntimeGo) GetInitializer() *RuntimeGoInitializer

func (*RuntimeGo) GetModule

func (r *RuntimeGo) GetModule() *RuntimeGoModule

type RuntimeGoContextValues

type RuntimeGoContextValues struct {
	*RuntimeRpcValues
	Env  map[string]string
	Node string
}

type RuntimeGoInitializer

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

go 注册器

func (*RuntimeGoInitializer) RegisterAfterRt

func (ri *RuntimeGoInitializer) RegisterAfterRt(id string, fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.Module, out, in *rtapi.Envelope) error) error

func (*RuntimeGoInitializer) RegisterBeforeRt

func (ri *RuntimeGoInitializer) RegisterBeforeRt(id string, fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, m runtime.Module, envelope *rtapi.Envelope) (*rtapi.Envelope, error)) error

func (*RuntimeGoInitializer) RegisterEvent

func (ri *RuntimeGoInitializer) RegisterEvent()

func (*RuntimeGoInitializer) RegisterRpc

func (ri *RuntimeGoInitializer) RegisterRpc(id string, fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, m runtime.Module, payload string) (string, error)) error

func (*RuntimeGoInitializer) Rpc

func (r *RuntimeGoInitializer) Rpc(id string) (fn RuntimeRpcFunction, ok bool)

type RuntimeGoLogger

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

func (*RuntimeGoLogger) Debug

func (l *RuntimeGoLogger) Debug(format string, v ...interface{})

func (*RuntimeGoLogger) Error

func (l *RuntimeGoLogger) Error(format string, v ...interface{})

func (*RuntimeGoLogger) Fields

func (l *RuntimeGoLogger) Fields() map[string]interface{}

func (*RuntimeGoLogger) Info

func (l *RuntimeGoLogger) Info(format string, v ...interface{})

func (*RuntimeGoLogger) Warn

func (l *RuntimeGoLogger) Warn(format string, v ...interface{})

func (*RuntimeGoLogger) WithField

func (l *RuntimeGoLogger) WithField(key string, v interface{}) nanaruntime.Logger

func (*RuntimeGoLogger) WithFields

func (l *RuntimeGoLogger) WithFields(fields map[string]interface{}) nanaruntime.Logger

type RuntimeGoModule

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

func NewRuntimeGoModule

func NewRuntimeGoModule(log *zap.Logger, db *sql.DB, metrics metrics.Metrics, c Configuration) *RuntimeGoModule

func (*RuntimeGoModule) AuthenticateEmail

func (rm *RuntimeGoModule) AuthenticateEmail()

type RuntimeRpcFunction

type RuntimeRpcFunction func(ctx context.Context, rpcValues *RuntimeRpcValues, payload string) (codes.Code, string, error)

type RuntimeRpcValues

type RuntimeRpcValues struct {
	Id          string
	Headers     map[string][]string
	QueryParams map[string][]string
	UserId      string
	Username    string
	Vars        map[string]string
	Expiry      int64
	SessionID   string
	ClientIP    string
	ClientPort  string
	Lang        string
}

Jump to

Keyboard shortcuts

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