Documentation ¶
Index ¶
- func FirstRun() *version.Version
- func Latest() *version.Version
- func RegisterSwaggerJSON(json string)
- func RestError401(req *restful.Request, resp *restful.Response, err error)
- func RestError403(req *restful.Request, resp *restful.Response, err error)
- func RestError404(req *restful.Request, resp *restful.Response, err error)
- func RestError423(req *restful.Request, resp *restful.Response, err error)
- func RestError500(req *restful.Request, resp *restful.Response, err error)
- func RestError503(req *restful.Request, resp *restful.Response, err error)
- func RestErrorDetect(req *restful.Request, resp *restful.Response, err error, defaultCode ...int32)
- func SwaggerSpec() *loads.Document
- func UpdateServiceVersion(opts *ServiceOptions) error
- func ValidVersion(v string) *version.Version
- type ChildrenRunner
- func (c *ChildrenRunner) FilterOutSource(ctx context.Context, sourceName string) bool
- func (c *ChildrenRunner) OnDeleteConfig(callback func(context.Context, string))
- func (c *ChildrenRunner) Start(ctx context.Context, source string, retries ...int) error
- func (c *ChildrenRunner) StartFromInitialConf(ctx context.Context, cfg configx.Values)
- func (c *ChildrenRunner) StopAll(ctx context.Context)
- func (c *ChildrenRunner) Watch(ctx context.Context) error
- type Migration
- type ProtoEntityReaderWriter
- type Service
- type ServiceOption
- func AfterServe(f func(ctx context.Context) error) ServiceOption
- func AutoRestart(b bool) ServiceOption
- func AutoStart(b bool) ServiceOption
- func Cancel(c context.CancelFunc) ServiceOption
- func Context(c context.Context) ServiceOption
- func Description(d string) ServiceOption
- func ForceRegister(b bool) ServiceOption
- func Fork(f bool) ServiceOption
- func ID(n string) ServiceOption
- func Metadata(name, value string) ServiceOption
- func Migrations(migrations []*Migration) ServiceOption
- func Name(n string) ServiceOption
- func PluginBoxes(boxes ...frontend.PluginBox) ServiceOption
- func Source(s string) ServiceOption
- func Tag(t ...string) ServiceOption
- func Unique(b bool) ServiceOption
- func WithChildrenRunner(parentName string, childrenPrefix string, cleanEndpointBeforeDelete bool, ...) []ServiceOption
- func WithGRPC(f func(context.Context, grpc.ServiceRegistrar) error) ServiceOption
- func WithGRPCStop(f func(context.Context, grpc.ServiceRegistrar) error) ServiceOption
- func WithGeneric(f func(context.Context, *generic.Server) error) ServiceOption
- func WithGenericStop(f func(context.Context, *generic.Server) error) ServiceOption
- func WithHTTP(f func(context.Context, server.HttpMux) error) ServiceOption
- func WithHTTPStop(f func(context.Context, server.HttpMux) error) ServiceOption
- func WithIndexer(fd dao.DaoWrapperFunc, opts ...StorageOption) ServiceOption
- func WithPureHTTP(f func(context.Context, server.HttpMux) error) ServiceOption
- func WithServer(s server.Server) ServiceOption
- func WithServerScheme(scheme string) ServiceOption
- func WithStorage(fd dao.DaoWrapperFunc, opts ...StorageOption) ServiceOption
- func WithTLSConfig(c *tls.Config) ServiceOption
- func WithWeb(handler func(ctx context.Context) WebHandler) ServiceOption
- func WithWebSession(excludes ...string) ServiceOption
- func WithWebStop(handler func(ctx context.Context) error) ServiceOption
- type ServiceOptions
- type Stopper
- type StorageOption
- type StorageOptions
- type WebHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSwaggerJSON ¶
func RegisterSwaggerJSON(json string)
RegisterSwaggerJSON receives a json string and adds it to the swagger definition
func RestError401 ¶
RestError401 logs the error with context and write an Error 401 on the response.
func RestError403 ¶
RestError403 logs the error with context and write an Error 403 on the response.
func RestError404 ¶
RestError404 logs the error with context and writes an Error 404 on the response.
func RestError423 ¶
RestError423 logs the error with context and write an Error 423 on the response.
func RestError500 ¶
RestError500 logs the error with context and write an Error 500 on the response.
func RestError503 ¶
RestError503 logs the error with context and write an Error 503 on the response.
func RestErrorDetect ¶
RestErrorDetect parses the error and tries to detect the correct code.
func SwaggerSpec ¶
SwaggerSpec returns the swagger specification as a document
func UpdateServiceVersion ¶
func UpdateServiceVersion(opts *ServiceOptions) error
UpdateServiceVersion applies migration(s) if necessary and stores new current version for future use.
func ValidVersion ¶
ValidVersion creates a version.NewVersion ignoring the error.
Types ¶
type ChildrenRunner ¶
type ChildrenRunner struct {
// contains filtered or unexported fields
}
ChildrenRunner For Regexp based service
func NewChildrenRunner ¶
func NewChildrenRunner(parentName string, childPrefix string, secondaryPrefix ...string) *ChildrenRunner
NewChildrenRunner creates a ChildrenRunner
func (*ChildrenRunner) FilterOutSource ¶
func (c *ChildrenRunner) FilterOutSource(ctx context.Context, sourceName string) bool
FilterOutSource checks in the actual source config if there are some keys that would prevent running on this node
func (*ChildrenRunner) OnDeleteConfig ¶
func (c *ChildrenRunner) OnDeleteConfig(callback func(context.Context, string))
OnDeleteConfig defines what's happening when the config related to the service is deleted
func (*ChildrenRunner) StartFromInitialConf ¶
func (c *ChildrenRunner) StartFromInitialConf(ctx context.Context, cfg configx.Values)
StartFromInitialConf list the sources keys and start them
func (*ChildrenRunner) StopAll ¶
func (c *ChildrenRunner) StopAll(ctx context.Context)
StopAll services
type Migration ¶
type Migration struct { TargetVersion *version.Version Up func(ctx context.Context) error Down func(ctx context.Context) error }
Migration defines a target version and functions to upgrade and/or downgrade.
type ProtoEntityReaderWriter ¶
type ProtoEntityReaderWriter struct { }
ProtoEntityReaderWriter can read and write values using an encoding such as JSON,XML.
func (*ProtoEntityReaderWriter) Read ¶
func (e *ProtoEntityReaderWriter) Read(req *restful.Request, v interface{}) error
Read a serialized version of the value from the request. The Request may have a decompressing reader. Depends on Content-Encoding.
func (*ProtoEntityReaderWriter) Write ¶
func (e *ProtoEntityReaderWriter) Write(resp *restful.Response, status int, v interface{}) error
Write a serialized version of the value on the response. The Response may have a compressing writer. Depends on Accept-Encoding. status should be a valid Http Status code
type Service ¶
type Service interface { Init(opts ...ServiceOption) Options() *ServiceOptions Metadata() map[string]string ID() string Name() string Version() string Tags() []string Start(oo ...registry.RegisterOption) error Stop(oo ...registry.RegisterOption) error OnServe(oo ...registry.RegisterOption) error ServerScheme() string Server() server.Server Is(status registry.Status) bool As(i interface{}) bool }
func NewService ¶
func NewService(opts ...ServiceOption) Service
NewService creates a service and directly register it as StatusStopped
type ServiceOption ¶
type ServiceOption func(*ServiceOptions)
ServiceOption provides a functional option
func AfterServe ¶
func AfterServe(f func(ctx context.Context) error) ServiceOption
AfterServe registers a callback that is run after Server is finally started (non-blocking)
func ForceRegister ¶ added in v4.0.1
func ForceRegister(b bool) ServiceOption
ForceRegister option for a service
func Metadata ¶
func Metadata(name, value string) ServiceOption
Metadata registers a key/value metadata
func Migrations ¶
func Migrations(migrations []*Migration) ServiceOption
Migrations option for a service
func PluginBoxes ¶
func PluginBoxes(boxes ...frontend.PluginBox) ServiceOption
PluginBoxes option for a service
func WithChildrenRunner ¶
func WithChildrenRunner(parentName string, childrenPrefix string, cleanEndpointBeforeDelete bool, afterDeleteListener func(context.Context, string), secondaryPrefix ...string) []ServiceOption
WithChildrenRunner option to define a micro server that runs children services
func WithGRPC ¶
func WithGRPC(f func(context.Context, grpc.ServiceRegistrar) error) ServiceOption
WithGRPC adds a GRPC service handler to the current service
func WithGRPCStop ¶
func WithGRPCStop(f func(context.Context, grpc.ServiceRegistrar) error) ServiceOption
WithGRPCStop hooks to the grpc server stop
func WithGeneric ¶
WithGeneric adds a http micro service handler to the current service
func WithGenericStop ¶
WithGenericStop adds a http micro service handler to the current service
func WithHTTPStop ¶
func WithIndexer ¶
func WithIndexer(fd dao.DaoWrapperFunc, opts ...StorageOption) ServiceOption
WithIndexer adds an indexer handler to the current service
func WithPureHTTP ¶ added in v4.0.1
WithPureHTTP adds a http micro service handler to the current service
func WithServer ¶
func WithServer(s server.Server) ServiceOption
WithServer directly presets the server.Server instance
func WithServerScheme ¶ added in v4.0.1
func WithServerScheme(scheme string) ServiceOption
func WithStorage ¶
func WithStorage(fd dao.DaoWrapperFunc, opts ...StorageOption) ServiceOption
WithStorage adds a storage handler to the current service
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServiceOption
WithTLSConfig option for a service
func WithWeb ¶
func WithWeb(handler func(ctx context.Context) WebHandler) ServiceOption
WithWeb returns a web handler
func WithWebSession ¶
func WithWebSession(excludes ...string) ServiceOption
func WithWebStop ¶
func WithWebStop(handler func(ctx context.Context) error) ServiceOption
WithWebStop registers an optional callback to perform clean operations on stop WithWeb already registers a serverStop callback to remove rest patterns
type ServiceOptions ¶
type ServiceOptions struct { Name string `json:"name"` ID string `json:"id"` Tags []string `json:"tags"` Version string `json:"version"` Description string `json:"description"` Source string `json:"source"` Metadata map[string]string `json:"metadata"` Context context.Context `json:"-"` Cancel context.CancelFunc `json:"-"` Migrations []*Migration `json:"-"` // Port string TLSConfig *tls.Config Server server.Server `json:"-"` // Starting options ForceRegister bool `json:"-"` AutoStart bool `json:"-"` AutoRestart bool `json:"-"` Fork bool `json:"-"` Unique bool `json:"-"` // Before and After funcs BeforeStart []func(context.Context) error `json:"-"` BeforeStop []func(context.Context) error `json:"-"` AfterServe []func(context.Context) error `json:"-"` UseWebSession bool `json:"-"` WebSessionExcludes []string `json:"-"` Storages []*StorageOptions `json:"-"` // contains filtered or unexported fields }
ServiceOptions stores all options for a pydio service
type StorageOption ¶
type StorageOption func(options *StorageOptions)
func WithStorageDefaultDriver ¶
func WithStorageDefaultDriver(d func() (string, string)) StorageOption
WithStorageDefaultDriver provides a default driver/dsn couple if not set in the configuration
func WithStorageMigrator ¶
func WithStorageMigrator(d dao.MigratorFunc) StorageOption
WithStorageMigrator provides a Migrate function from one DAO to another
func WithStoragePrefix ¶
func WithStoragePrefix(i interface{}) StorageOption
WithStoragePrefix sets a prefix to be used differently depending on driver name
func WithStorageSupport ¶
func WithStorageSupport(dd ...string) StorageOption
WithStorageSupport declares wich drivers can be supported by this service
type StorageOptions ¶
type StorageOptions struct { StorageKey string SupportedDrivers []string DefaultDriver dao.DriverProviderFunc Migrator dao.MigratorFunc // contains filtered or unexported fields }
func (*StorageOptions) Prefix ¶
func (o *StorageOptions) Prefix(options *ServiceOptions) string
func (*StorageOptions) ToMeta ¶ added in v4.0.1
func (o *StorageOptions) ToMeta() string
type WebHandler ¶
WebHandler defines what functions a web handler must answer to
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package servicecontext performs context values read/write, generally through server or client wrappers
|
Package servicecontext performs context values read/write, generally through server or client wrappers |
Package frontend provides tools to publish static data from within any micro service
|
Package frontend provides tools to publish static data from within any micro service |
sessions/securecookie
Package securecookie provides tools for using Bolt as a standard persistence layer for services
|
Package securecookie provides tools for using Bolt as a standard persistence layer for services |
Package resources provides extendable service Handler for managing resource-policy based data.
|
Package resources provides extendable service Handler for managing resource-policy based data. |