server

package
v0.0.0-...-280633d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRPCPort = 10118

	DefaultWebPort = 10119

	DefaultMongoConnectionURI        = "mongodb://localhost:27017"
	DefaultMongoConnectionTimeoutSec = 5
	DefaultMongoPingTimeoutSec       = 5
	DefaultMongoDatabase             = "metis"

	DefaultYorkieRPCAddr      = "localhost:11101"
	DefaultYorkieWebhookToken = "metis-server"
	DefaultYorkieCollection   = "projects"
)

The following are the defaults for the Server config.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RPC    *rpc.Config     `json:"RPC"`
	Web    *web.Config     `json:"Web"`
	Mongo  *mongodb.Config `json:"Mongo"`
	Yorkie *yorkie.Config  `json:"Yorkie"`
}

Config is the configuration for creating a Server instance.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct that contains reasonable defaults for most of the configurations.

func (Config) RPCAddr

func (c Config) RPCAddr() string

RPCAddr returns the RPC address.

type Server

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

Server receives requests from the client, stores data in the database,

func New

func New(conf *Config) (*Server, error)

New creates a new instance of Server.

func (*Server) RPCAddr

func (s *Server) RPCAddr() string

RPCAddr returns the RPC address.

func (*Server) Shutdown

func (s *Server) Shutdown(graceful bool) error

Shutdown shuts down this server.

func (*Server) ShutdownCh

func (s *Server) ShutdownCh() <-chan struct{}

ShutdownCh returns the shutdown channel.

func (*Server) Start

func (s *Server) Start() error

Start starts the server by opening the rpc port.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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