router

package
v5.8.1-12 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool interface {
	// Borrow acquires a connection from the provided list of servers
	// If all connections are busy and the pool is full, calls to Borrow may wait for a connection to become idle
	// If a connection has been idle for longer than idlenessThreshold, it will be reset
	// to check if it's still alive.
	Borrow(ctx context.Context, getServers func(context.Context) ([]string, error), wait bool, boltLogger log.BoltLogger, idlenessThreshold time.Duration, auth *idb.ReAuthToken) (idb.Connection, error)
	Return(ctx context.Context, c idb.Connection) error
}

type Router

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

Router is thread safe

func New

func New(rootRouter string, getRouters func() []string, routerContext map[string]string, pool Pool, logger log.Logger, logId string, timer *func() time.Time) *Router

func (*Router) CleanUp

func (r *Router) CleanUp(ctx context.Context) error

func (*Router) Context

func (r *Router) Context() map[string]string

func (*Router) GetNameOfDefaultDatabase

func (r *Router) GetNameOfDefaultDatabase(ctx context.Context, bookmarks []string, user string, auth *idb.ReAuthToken, boltLogger log.BoltLogger) (string, error)

func (*Router) GetOrUpdateReaders

func (r *Router) GetOrUpdateReaders(ctx context.Context, bookmarks func(context.Context) ([]string, error), database string, auth *idb.ReAuthToken, boltLogger log.BoltLogger) ([]string, error)

func (*Router) GetOrUpdateWriters

func (r *Router) GetOrUpdateWriters(ctx context.Context, bookmarks func(context.Context) ([]string, error), database string, auth *idb.ReAuthToken, boltLogger log.BoltLogger) ([]string, error)

func (*Router) Invalidate

func (r *Router) Invalidate(ctx context.Context, database string) error

func (*Router) InvalidateReader

func (r *Router) InvalidateReader(ctx context.Context, db string, server string) error

func (*Router) InvalidateWriter

func (r *Router) InvalidateWriter(ctx context.Context, db string, server string) error

func (*Router) Readers

func (r *Router) Readers(ctx context.Context, database string) ([]string, error)

func (*Router) Writers

func (r *Router) Writers(ctx context.Context, database string) ([]string, error)

Jump to

Keyboard shortcuts

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