Documentation ¶
Overview ¶
Package archive provides a generic system to create archive api services.
This package is a work in progress and makes no API stability promises.
Index ¶
- func RegisterBackendBuilder(class string, builder BuildBackendFn)
- func RegisterServiceBuilder(class string, builder BuildServiceFn)
- type API
- type Backend
- type BackendDef
- type BuildBackendFn
- type BuildServiceFn
- type Builder
- func (b *Builder) Backend(id string) (Backend, bool)
- func (b *Builder) BuildBackend(def BackendDef) (Backend, error)
- func (b *Builder) BuildService(def ServiceDef) (Service, error)
- func (b Builder) Logger() yalogi.Logger
- func (b *Builder) OnShutdown(f func() error)
- func (b *Builder) OnStartup(f func() error)
- func (b *Builder) PingAll() error
- func (b *Builder) Service(id string) (Service, bool)
- func (b *Builder) Shutdown() error
- func (b *Builder) Start() error
- type BuilderOption
- type Service
- type ServiceDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterBackendBuilder ¶
func RegisterBackendBuilder(class string, builder BuildBackendFn)
RegisterBackendBuilder registers a builder.
func RegisterServiceBuilder ¶
func RegisterServiceBuilder(class string, builder BuildServiceFn)
RegisterServiceBuilder registers a builder.
Types ¶
type BackendDef ¶
type BackendDef struct { // ID must exist and be unique ID string `json:"id"` // Class stores the driver Class string `json:"class"` // Disabled flag Disabled bool `json:"disabled"` // Name or description Name string `json:"name,omitempty"` // URL provides the url to backend URL string `json:"url,omitempty"` // Client configuration Client *grpctls.ClientCfg `json:"tls,omitempty"` // Opts custom options Opts map[string]interface{} `json:"opts,omitempty"` }
BackendDef stores configuration definition of backends.
func BackendDefsFromFile ¶
func BackendDefsFromFile(path string) ([]BackendDef, error)
BackendDefsFromFile creates a slice from a file in json format.
func (BackendDef) ClientCfg ¶
func (def BackendDef) ClientCfg() grpctls.ClientCfg
ClientCfg returns a copy of client configuration. It returns an empty struct if a null pointer is stored.
type BuildBackendFn ¶
type BuildBackendFn func(b *Builder, def BackendDef) (Backend, error)
BuildBackendFn defines a function that constructs a Backend.
type BuildServiceFn ¶
type BuildServiceFn func(b *Builder, def ServiceDef) (Service, error)
BuildServiceFn defines a function that constructs a Service.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs backends and services from definitions.
func NewBuilder ¶
func NewBuilder(opt ...BuilderOption) *Builder
NewBuilder instances a new builder.
func (*Builder) BuildBackend ¶
func (b *Builder) BuildBackend(def BackendDef) (Backend, error)
BuildBackend creates a Backend using the definition passed as param.
func (*Builder) BuildService ¶
func (b *Builder) BuildService(def ServiceDef) (Service, error)
BuildService creates a Service using the definition passed as param.
func (*Builder) OnShutdown ¶
OnShutdown registers the functions that will be executed during shutdown.
type BuilderOption ¶
type BuilderOption func(*buildOpts)
BuilderOption is used for builder configuration.
func SetLogger ¶
func SetLogger(l yalogi.Logger) BuilderOption
SetLogger sets a logger for the component.
type ServiceDef ¶
type ServiceDef struct { // ID must exist and be unique ID string `json:"id"` // Class stores the services class Class string `json:"class"` // Disabled flag Disabled bool `json:"disabled"` // Name or description Name string `json:"name,omitempty"` // Backend ID Backend string `json:"backend,omitempty"` // Opts custom options Opts map[string]interface{} `json:"opts,omitempty"` }
ServiceDef stores configuration definition of services.
func ServiceDefsFromFile ¶
func ServiceDefsFromFile(path string) ([]ServiceDef, error)
ServiceDefsFromFile creates a slice from a file in json format.
Directories ¶
Path | Synopsis |
---|---|
backends
|
|
services
|
|
dnsmdb
Package dnsmdb implements dnsutil.Archive using mongodb backend.
|
Package dnsmdb implements dnsutil.Archive using mongodb backend. |
eventmdb
Package eventmdb implements event.Archive using mongodb backend.
|
Package eventmdb implements event.Archive using mongodb backend. |
tlsmdb
Package tlsmdb implements tlsutil.Archive using mongodb backend.
|
Package tlsmdb implements tlsutil.Archive using mongodb backend. |