backend

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 14 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

	DB               db.DB
	Coordinator      sync.Coordinator
	Metrics          metrics.Metrics
	AuthWebhookCache *cache.LRUExpireCache
	// contains filtered or unexported fields
}

Backend manages Yorkie's remote states such as data store, distributed lock and etc. And it has the server status like the configuration.

func New

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

New creates a new instance of Backend.

func (*Backend) AttachGoroutine

func (b *Backend) AttachGoroutine(f func())

AttachGoroutine creates a goroutine on a given function and tracks it using the backend's WaitGroup.

func (*Backend) Close

func (b *Backend) Close() error

Close closes all resources of this instance.

func (*Backend) Members added in v0.1.5

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

Members returns the members of this cluster.

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 `json:"SnapshotThreshold"`

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

	// AuthorizationWebhookURL is the url of the authorization webhook.
	AuthorizationWebhookURL string `json:"AuthorizationWebhookURL"`

	// AuthorizationWebhookMethods is the methods that run the authorization webhook.
	AuthorizationWebhookMethods []string `json:"AuthorizationWebhookMethods"`

	// AuthorizationWebhookMaxRetries is the max count
	// that retries the authorization webhook.
	AuthorizationWebhookMaxRetries uint64 `json:"AuthorizationWebhookMaxRetries"`

	// AuthorizationWebhookMaxWaitIntervalMillis is the max interval
	// that waits before retrying the authorization webhook.
	AuthorizationWebhookMaxWaitIntervalMillis uint64 `json:"AuthorizationWebhookMaxWaitIntervalMillis"`

	// AuthorizationWebhookCacheAuthorizedTTLSec is the TTL value to set when caching the authorized result.
	AuthorizationWebhookCacheAuthorizedTTLSec uint64 `json:"AuthorizationWebhookCacheAuthorizedTTLSec"`

	// AuthorizationWebhookCacheAuthorizedTTLSec is the TTL value to set when caching the unauthorized result.
	AuthorizationWebhookCacheUnauthorizedTTLSec uint64 `json:"AuthorizationWebhookCacheUnauthorizedTTLSec"`
}

Config is the configuration for creating a Backend instance.

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