backend

package
v0.2.2-test Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Config *Config

	Background       *background.Background
	DB               db.DB
	Coordinator      sync.Coordinator
	Metrics          *prometheus.Metrics
	Housekeeping     *housekeeping.Housekeeping
	AuthWebhookCache *cache.LRUExpireCache
	// contains filtered or unexported fields
}

Backend manages Yorkie's backend such as Database and Coordinator. And it has the server status such as the information of this Agent.

func New

func New(
	conf *Config,
	mongoConf *mongo.Config,
	etcdConf *etcd.Config,
	housekeepingConf *housekeeping.Config,
	rpcAddr string,
	metrics *prometheus.Metrics,
) (*Backend, error)

New creates a new instance of Backend.

func (*Backend) Members added in v0.1.5

func (b *Backend) Members() map[string]*sync.AgentInfo

Members returns the members of this cluster.

func (*Backend) Shutdown added in v0.2.0

func (b *Backend) Shutdown() error

Shutdown closes all resources of this instance.

type Config

type Config struct {
	// SnapshotThreshold is the threshold that determines if changes should be
	// sent with snapshot when the number of changes is greater than this value.
	SnapshotThreshold uint64 `yaml:"SnapshotThreshold"`

	// SnapshotInterval is the interval of changes to create a snapshot.
	SnapshotInterval uint64 `yaml:"SnapshotInterval"`

	// AuthWebhookURL is the url of the authorization webhook.
	AuthWebhookURL string `yaml:"AuthWebhookURL"`

	// AuthWebhookMethods is the methods that run the authorization webhook.
	AuthWebhookMethods []string `yaml:"AuthWebhookMethods"`

	// AuthWebhookMaxRetries is the max count that retries the authorization webhook.
	AuthWebhookMaxRetries uint64 `yaml:"AuthWebhookMaxRetries"`

	// AuthWebhookMaxWaitInterval is the max interval that waits before retrying the authorization webhook.
	AuthWebhookMaxWaitInterval string `yaml:"AuthWebhookMaxWaitInterval"`

	// AuthWebhookCacheSize is the cache size of the authorization webhook.
	AuthWebhookCacheSize int `yaml:"AuthWebhookCacheSize"`

	// AuthWebhookCacheAuthTTL is the TTL value to set when caching the authorized result.
	AuthWebhookCacheAuthTTL string `yaml:"AuthWebhookCacheAuthTTL"`

	// AuthWebhookCacheUnauthTTL is the TTL value to set when caching the unauthorized result.
	AuthWebhookCacheUnauthTTL string `yaml:"AuthWebhookCacheUnauthTTL"`
}

Config is the configuration for creating a Backend instance.

func (*Config) ParseAuthWebhookCacheAuthTTL added in v0.1.7

func (c *Config) ParseAuthWebhookCacheAuthTTL() time.Duration

ParseAuthWebhookCacheAuthTTL returns TTL for authorized cache.

func (*Config) ParseAuthWebhookCacheUnauthTTL added in v0.1.7

func (c *Config) ParseAuthWebhookCacheUnauthTTL() time.Duration

ParseAuthWebhookCacheUnauthTTL returns TTL for unauthorized cache.

func (*Config) ParseAuthWebhookMaxWaitInterval added in v0.1.7

func (c *Config) ParseAuthWebhookMaxWaitInterval() time.Duration

ParseAuthWebhookMaxWaitInterval returns max wait interval.

func (*Config) RequireAuth added in v0.1.6

func (c *Config) RequireAuth(method types.Method) bool

RequireAuth returns whether the given method require authorization.

func (*Config) Validate added in v0.1.6

func (c *Config) Validate() error

Validate validates this config.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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