server

package
v5.0.0-...-2679821 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(out interface{}) bool

func InitPeerMeta

func InitPeerMeta(meta map[string]string)

Types

type CoreServer

type CoreServer interface {
	Name() string
	ID() string
	Type() Type
	As(interface{}) bool
}

type Option

type Option func(*Options)

Option is a function to set Options

type Options

type Options struct {
	Context  context.Context
	Listener *net.Listener
	Metadata map[string]string
	// contains filtered or unexported fields
}

Options stores all options for a pydio server

type RawServer

type RawServer interface {
	CoreServer
	Stop() error
	RawServe(options *ServeOptions) ([]registry.Item, error)
}

type ServeOption

type ServeOption func(options *ServeOptions)

func WithAfterServe

func WithAfterServe(f func(oo ...registry.RegisterOption) error) ServeOption

func WithBeforeServe

func WithBeforeServe(f func(oo ...registry.RegisterOption) error) ServeOption

func WithBlockUntilServe

func WithBlockUntilServe() ServeOption

func WithContext

func WithContext(ctx context.Context) ServeOption

func WithErrorCallback

func WithErrorCallback(cb func(err error)) ServeOption

func WithListener

func WithListener(l net.Listener) ServeOption

type ServeOptions

type ServeOptions struct {
	Context         context.Context
	Listener        net.Listener
	ErrorCallback   func(error)
	BlockUntilServe bool
	BeforeServe     []func(oo ...registry.RegisterOption) error
	AfterServe      []func(oo ...registry.RegisterOption) error

	RegistryOptions []registry.RegisterOption
}

type Server

type Server interface {
	CoreServer
	Serve(...ServeOption) error
	Stop(oo ...registry.RegisterOption) error

	Is(status registry.Status) bool
	NeedsRestart() bool
	Metadata() map[string]string

	RegisterContextInterceptor(interceptor propagator.IncomingContextModifier)
}

func NewServer

func NewServer(ctx context.Context, s RawServer) Server

func OpenProxy

func OpenProxy(ctx context.Context, urlstr string) (Server, error)

func OpenServer

func OpenServer(ctx context.Context, urlstr string) (Server, error)

OpenServer opens the Registry identified by the URL given. See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.

type Type

type Type int8
const (
	TypeGrpc Type = iota
	TypeHttp
	TypeHttpPure
	TypeGeneric
	TypeFork
)

type URLMux

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

URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.

The zero value is a multiplexer with no registered schemes.

func DefaultURLMux

func DefaultURLMux() *URLMux

DefaultURLMux returns the URLMux used by OpenTopic and OpenSubscription.

Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.

func ProxyURLMux

func ProxyURLMux() *URLMux

ProxyURLMux returns the URLMux used by OpenTopic and OpenSubscription.

Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.

func (*URLMux) OpenServer

func (mux *URLMux) OpenServer(ctx context.Context, urlstr string) (Server, error)

OpenServer calls OpenTopicURL with the URL parsed from urlstr. OpenTopic is safe to call from multiple goroutines.

func (*URLMux) Register

func (mux *URLMux) Register(scheme string, opener URLOpener)

Register registers the opener with the given scheme. If an opener already exists for the scheme, Register panics.

func (*URLMux) Schemes

func (mux *URLMux) Schemes() []string

Schemes returns a sorted slice of the registered schemes.

func (*URLMux) ValidScheme

func (mux *URLMux) ValidScheme(scheme string) bool

ValidScheme returns true if scheme has been registered.

type URLOpener

type URLOpener interface {
	OpenURL(ctx context.Context, u *url.URL) (Server, error)
}

URLOpener represents types than can open Registries based on a URL. The opener must not modify the URL argument. OpenURL must be safe to call from multiple goroutines.

This interface is generally implemented by types in driver packages.

Directories

Path Synopsis
api
mux

Jump to

Keyboard shortcuts

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