server

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package server provides the Yorkie server which is the main entry point of the Yorkie system. The server is responsible for starting the RPC server and admin server.

Index

Constants

View Source
const (
	DefaultRPCPort                  = 8080
	DefaultRPCMaxRequestsBytes      = 4 * 1024 * 1024 // 4MiB
	DefaultRPCMaxConnectionAge      = 0 * time.Second
	DefaultRPCMaxConnectionAgeGrace = 0 * time.Second

	DefaultProfilingPort = 8081

	DefaultHousekeepingInterval                  = 30 * time.Second
	DefaultHousekeepingCandidatesLimitPerProject = 500
	DefaultHousekeepingProjectFetchSize          = 100

	DefaultMongoConnectionURI     = "mongodb://localhost:27017"
	DefaultMongoConnectionTimeout = 5 * time.Second
	DefaultMongoPingTimeout       = 5 * time.Second
	DefaultMongoYorkieDatabase    = "yorkie-meta"

	DefaultAdminUser                  = "admin"
	DefaultAdminPassword              = "admin"
	DefaultSecretKey                  = "yorkie-secret"
	DefaultAdminTokenDuration         = 7 * 24 * time.Hour
	DefaultUseDefaultProject          = true
	DefaultClientDeactivateThreshold  = "24h"
	DefaultSnapshotThreshold          = 1000
	DefaultSnapshotInterval           = 3000
	DefaultSnapshotWithPurgingChanges = false
	DefaultSnapshotDisableGC          = false

	DefaultAuthWebhookMaxRetries      = 10
	DefaultAuthWebhookMaxWaitInterval = 3000 * time.Millisecond
	DefaultAuthWebhookCacheSize       = 5000
	DefaultAuthWebhookCacheAuthTTL    = 10 * time.Second
	DefaultAuthWebhookCacheUnauthTTL  = 10 * time.Second
	DefaultProjectInfoCacheSize       = 256
	DefaultProjectInfoCacheTTL        = 10 * time.Minute

	DefaultHostname    = ""
	DefaultGatewayAddr = "localhost:8080"
)

Below are the values of the default values of Yorkie config.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RPC          *rpc.Config          `yaml:"RPC"`
	Profiling    *profiling.Config    `yaml:"Profiling"`
	Housekeeping *housekeeping.Config `yaml:"Housekeeping"`
	Backend      *backend.Config      `yaml:"Backend"`
	Mongo        *mongo.Config        `yaml:"Mongo"`
}

Config is the configuration for creating a Yorkie instance.

func NewConfig

func NewConfig() *Config

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

func NewConfigFromFile

func NewConfigFromFile(path string) (*Config, error)

NewConfigFromFile returns a Config struct for the given conf file.

func (*Config) RPCAddr

func (c *Config) RPCAddr() string

RPCAddr returns the RPC address.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the provided Config is invalidated.

type Yorkie

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

Yorkie is a server of Yorkie. The server receives changes from the client, stores them in the repository, and propagates the changes to clients who subscribe to the document.

func New

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

New creates a new instance of Yorkie.

func (*Yorkie) CreateProject added in v0.4.25

func (r *Yorkie) CreateProject(ctx context.Context, name string) (*types.Project, error)

CreateProject creates a project with the given name.

func (*Yorkie) DeactivateClient added in v0.4.21

func (r *Yorkie) DeactivateClient(ctx context.Context, c1 *client.Client) error

DeactivateClient deactivates the given client. It is used for testing.

func (*Yorkie) DefaultProject added in v0.4.25

func (r *Yorkie) DefaultProject(ctx context.Context) (*types.Project, error)

DefaultProject returns the default project.

func (*Yorkie) RPCAddr

func (r *Yorkie) RPCAddr() string

RPCAddr returns the address of the RPC.

func (*Yorkie) RegisterHousekeepingTasks added in v0.4.28

func (r *Yorkie) RegisterHousekeepingTasks(be *backend.Backend) error

RegisterHousekeepingTasks registers housekeeping tasks.

func (*Yorkie) Shutdown

func (r *Yorkie) Shutdown(graceful bool) error

Shutdown shuts down this Yorkie server.

func (*Yorkie) ShutdownCh

func (r *Yorkie) ShutdownCh() <-chan struct{}

ShutdownCh returns the shutdown channel.

func (*Yorkie) Start

func (r *Yorkie) Start() error

Start starts the server by opening the rpc port.

Directories

Path Synopsis
Package backend provides the backend implementation of the Yorkie.
Package backend provides the backend implementation of the Yorkie.
background
Package background provides the background service.
Package background provides the background service.
database
Package database provides the database interface for the Yorkie backend.
Package database provides the database interface for the Yorkie backend.
database/memory
Package memory implements the database interface using in-memory database.
Package memory implements the database interface using in-memory database.
database/mongo
Package mongo implements database interfaces using MongoDB.
Package mongo implements database interfaces using MongoDB.
database/testcases
Package testcases contains testcases for database.
Package testcases contains testcases for database.
housekeeping
Package housekeeping is the package for housekeeping service.
Package housekeeping is the package for housekeeping service.
sync
Package sync provides the synchronization primitives for the server.
Package sync provides the synchronization primitives for the server.
sync/memory
Package memory provides the memory implementation of the sync package.
Package memory provides the memory implementation of the sync package.
Package clients provides the client related business logic.
Package clients provides the client related business logic.
Package documents provides the document related business logic.
Package documents provides the document related business logic.
Package logging provides logging facilities for Yorkie Server.
Package logging provides logging facilities for Yorkie Server.
Package packs implements PushPullPack which is used to sync the document between the client and the server.
Package packs implements PushPullPack which is used to sync the document between the client and the server.
Package profiling provides profiling server.
Package profiling provides profiling server.
prometheus
Package prometheus provides a Prometheus metrics exporter.
Package prometheus provides a Prometheus metrics exporter.
Package projects provides the project related business logic.
Package projects provides the project related business logic.
rpc
Package rpc provides the rpc server which is responsible for handling requests from the client.
Package rpc provides the rpc server which is responsible for handling requests from the client.
auth
Package auth provides authentication and authorization for RPCs.
Package auth provides authentication and authorization for RPCs.
connecthelper
Package connecthelper provides helper functions for connectRPC.
Package connecthelper provides helper functions for connectRPC.
httphealth
Package httphealth uses http GET to provide a health check for the server.
Package httphealth uses http GET to provide a health check for the server.
interceptors
Package interceptors provides the interceptors for RPC.
Package interceptors provides the interceptors for RPC.
metadata
Package metadata provides metadata for RPC.
Package metadata provides metadata for RPC.
testcases
Package testcases contains testcases for server
Package testcases contains testcases for server
Package users provides the user related business logic.
Package users provides the user related business logic.

Jump to

Keyboard shortcuts

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