Documentation ¶
Index ¶
- Constants
- Variables
- func New(options Options) (manager services.EndpointsManager, shared shareds.Shared, ...)
- func NewInternalHandler(local services.Endpoints, signature signatures.Signature) transports.MuxHandler
- func NewSignature(secret string) signatures.Signature
- func RegisterCluster(name string, cluster Cluster)
- func RegisterHostRetriever(name string, fn HostRetriever)
- type Cluster
- type ClusterBuilderOptions
- type ClusterEndpointsManager
- type ClusterOptions
- type Config
- type Development
- func (cluster *Development) AddService(_ Service)
- func (cluster *Development) Barrier() (barrier barriers.Barrier)
- func (cluster *Development) Client() transports.Client
- func (cluster *Development) Construct(options ClusterOptions) (err error)
- func (cluster *Development) Join(ctx context.Context) (err error)
- func (cluster *Development) Leave(_ context.Context) (err error)
- func (cluster *Development) NodeEvents() (events <-chan NodeEvent)
- func (cluster *Development) Shared() (shared shareds.Shared)
- type DevelopmentConfig
- type Endpoint
- func (endpoint *Endpoint) AddFn(name string, internal bool, readonly bool)
- func (endpoint *Endpoint) Address() string
- func (endpoint *Endpoint) Document() documents.Endpoint
- func (endpoint *Endpoint) Functions() services.Fns
- func (endpoint *Endpoint) Id() string
- func (endpoint *Endpoint) Info() services.EndpointInfo
- func (endpoint *Endpoint) Internal() bool
- func (endpoint *Endpoint) IsHealth() bool
- func (endpoint *Endpoint) Name() string
- func (endpoint *Endpoint) Running() bool
- func (endpoint *Endpoint) Shutdown(_ context.Context)
- type Endpoints
- func (endpoints *Endpoints) Add(ep *Endpoint)
- func (endpoints *Endpoints) Get(id []byte) *Endpoint
- func (endpoints *Endpoints) Infos() (v services.EndpointInfos)
- func (endpoints *Endpoints) MaxOne() (ep *Endpoint)
- func (endpoints *Endpoints) Range(interval versions.Interval) *Endpoint
- func (endpoints *Endpoints) Remove(id []byte)
- type Entry
- type Fn
- type HostRetriever
- type InternalHandler
- func (handler *InternalHandler) Construct(_ transports.MuxHandlerOptions) error
- func (handler *InternalHandler) Handle(w transports.ResponseWriter, r transports.Request)
- func (handler *InternalHandler) Match(_ context.Context, method []byte, path []byte, header transports.Header) bool
- func (handler *InternalHandler) Name() string
- type Manager
- func (manager *Manager) Add(service services.Service) (err error)
- func (manager *Manager) FnAddress(ctx context.Context, endpoint []byte, fnName []byte, ...) (address string, internal bool, has bool)
- func (manager *Manager) Get(ctx context.Context, name []byte, options ...services.EndpointGetOption) (endpoint services.Endpoint, has bool)
- func (manager *Manager) Info() (infos services.EndpointInfos)
- func (manager *Manager) Listen(ctx context.Context) (err error)
- func (manager *Manager) Request(ctx context.Context, name []byte, fn []byte, param interface{}, ...) (response services.Response, err error)
- func (manager *Manager) RequestAsync(ctx context.Context, name []byte, fn []byte, param any, ...) (future futures.Future, err error)
- func (manager *Manager) Shutdown(ctx context.Context)
- type Node
- type NodeEvent
- type NodeEventKind
- type Nodes
- type Options
- type Registration
- func (r *Registration) Add(endpoint *Endpoint)
- func (r *Registration) Get(name []byte, id []byte) *Endpoint
- func (r *Registration) Infos() (v services.EndpointInfos)
- func (r *Registration) MaxOne(name []byte) *Endpoint
- func (r *Registration) Range(name []byte, interval versions.Interval) *Endpoint
- func (r *Registration) Remove(name string, id string)
- type RequestBody
- type ResponseBody
- type Service
- type SortedVersionEndpoints
- func (list SortedVersionEndpoints) Add(ep *Endpoint) SortedVersionEndpoints
- func (list SortedVersionEndpoints) Get(version versions.Version) *VersionEndpoints
- func (list SortedVersionEndpoints) Len() int
- func (list SortedVersionEndpoints) Less(i, j int) bool
- func (list SortedVersionEndpoints) Swap(i, j int)
- type VersionEndpoints
Constants ¶
View Source
const ( Add = NodeEventKind(1) Remove = NodeEventKind(2) )
Variables ¶
View Source
var ( ErrTooEarly = errors.TooEarly("fns: service is not ready, try later again") ErrDeviceId = errors.Warning("fns: device id was required") ErrInvalidPath = errors.Warning("fns: invalid path") ErrInvalidBody = errors.Warning("fns: invalid body") ErrInvalidRequestVersions = errors.Warning("fns: invalid request versions") ErrTooMayRequest = errors.TooMayRequest("fns: too may request, try again later") ErrSignatureLost = errors.New(488, "***SIGNATURE LOST***", "X-Fns-Signature was required") ErrSignatureUnverified = errors.New(458, "***SIGNATURE INVALID***", "X-Fns-Signature was invalid") )
Functions ¶
func New ¶
func New(options Options) (manager services.EndpointsManager, shared shareds.Shared, barrier barriers.Barrier, handlers []transports.MuxHandler, err error)
func NewInternalHandler ¶
func NewInternalHandler(local services.Endpoints, signature signatures.Signature) transports.MuxHandler
func NewSignature ¶
func NewSignature(secret string) signatures.Signature
func RegisterCluster ¶
func RegisterHostRetriever ¶
func RegisterHostRetriever(name string, fn HostRetriever)
Types ¶
type Cluster ¶
type Cluster interface { Construct(options ClusterOptions) (err error) AddService(service Service) Join(ctx context.Context) (err error) Leave(ctx context.Context) (err error) NodeEvents() (events <-chan NodeEvent) Barrier() (barrier barriers.Barrier) }
func NewDevelopment ¶
func NewDevelopment(dialer transports.Dialer, signature signatures.Signature) Cluster
type ClusterBuilderOptions ¶
type ClusterBuilderOptions struct { Config configures.Config Log logs.Logger }
type ClusterEndpointsManager ¶
type ClusterEndpointsManager interface { services.EndpointsManager FnAddress(ctx context.Context, endpoint []byte, fnName []byte, options ...services.EndpointGetOption) (address string, internal bool, has bool) }
func NewManager ¶
func NewManager(id string, version versions.Version, address string, cluster Cluster, local services.EndpointsManager, worker workers.Workers, log logs.Logger, dialer transports.Dialer, signature signatures.Signature) ClusterEndpointsManager
type ClusterOptions ¶
type Development ¶
type Development struct {
// contains filtered or unexported fields
}
func (*Development) AddService ¶
func (cluster *Development) AddService(_ Service)
func (*Development) Barrier ¶ added in v1.2.0
func (cluster *Development) Barrier() (barrier barriers.Barrier)
func (*Development) Client ¶ added in v1.2.80
func (cluster *Development) Client() transports.Client
func (*Development) Construct ¶
func (cluster *Development) Construct(options ClusterOptions) (err error)
func (*Development) NodeEvents ¶
func (cluster *Development) NodeEvents() (events <-chan NodeEvent)
func (*Development) Shared ¶
func (cluster *Development) Shared() (shared shareds.Shared)
type DevelopmentConfig ¶
type DevelopmentConfig struct {
ProxyAddr string `json:"proxyAddr"`
}
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func NewEndpoint ¶
func (*Endpoint) Info ¶
func (endpoint *Endpoint) Info() services.EndpointInfo
type Endpoints ¶
type Endpoints struct {
// contains filtered or unexported fields
}
func (*Endpoints) Infos ¶ added in v1.2.32
func (endpoints *Endpoints) Infos() (v services.EndpointInfos)
type HostRetriever ¶
type InternalHandler ¶
type InternalHandler struct {
// contains filtered or unexported fields
}
func (*InternalHandler) Construct ¶
func (handler *InternalHandler) Construct(_ transports.MuxHandlerOptions) error
func (*InternalHandler) Handle ¶
func (handler *InternalHandler) Handle(w transports.ResponseWriter, r transports.Request)
func (*InternalHandler) Match ¶
func (handler *InternalHandler) Match(_ context.Context, method []byte, path []byte, header transports.Header) bool
func (*InternalHandler) Name ¶
func (handler *InternalHandler) Name() string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Info ¶
func (manager *Manager) Info() (infos services.EndpointInfos)
func (*Manager) RequestAsync ¶ added in v1.2.34
type NodeEvent ¶
type NodeEvent struct { Kind NodeEventKind Node Node }
type NodeEventKind ¶
type NodeEventKind int
func (NodeEventKind) String ¶ added in v1.2.0
func (kind NodeEventKind) String() string
type Nodes ¶
type Nodes []Node
func MapEndpointInfosToNodes ¶
func MapEndpointInfosToNodes(infos services.EndpointInfos) (nodes Nodes)
func (Nodes) Difference ¶
type Registration ¶
type Registration struct {
// contains filtered or unexported fields
}
func (*Registration) Add ¶
func (r *Registration) Add(endpoint *Endpoint)
func (*Registration) Infos ¶ added in v1.2.32
func (r *Registration) Infos() (v services.EndpointInfos)
func (*Registration) MaxOne ¶
func (r *Registration) MaxOne(name []byte) *Endpoint
func (*Registration) Range ¶
func (r *Registration) Range(name []byte, interval versions.Interval) *Endpoint
func (*Registration) Remove ¶
func (r *Registration) Remove(name string, id string)
type RequestBody ¶
type ResponseBody ¶
type Service ¶
type Service struct { Name string `json:"name"` Internal bool `json:"internal"` Functions services.FnInfos `json:"functions"` DocumentRaw []byte `json:"document"` }
func NewService ¶
type SortedVersionEndpoints ¶ added in v1.2.32
type SortedVersionEndpoints []*VersionEndpoints
func (SortedVersionEndpoints) Add ¶ added in v1.2.32
func (list SortedVersionEndpoints) Add(ep *Endpoint) SortedVersionEndpoints
func (SortedVersionEndpoints) Get ¶ added in v1.2.32
func (list SortedVersionEndpoints) Get(version versions.Version) *VersionEndpoints
func (SortedVersionEndpoints) Len ¶ added in v1.2.32
func (list SortedVersionEndpoints) Len() int
func (SortedVersionEndpoints) Less ¶ added in v1.2.32
func (list SortedVersionEndpoints) Less(i, j int) bool
func (SortedVersionEndpoints) Swap ¶ added in v1.2.32
func (list SortedVersionEndpoints) Swap(i, j int)
type VersionEndpoints ¶ added in v1.2.32
type VersionEndpoints struct {
// contains filtered or unexported fields
}
func (*VersionEndpoints) Add ¶ added in v1.2.32
func (endpoints *VersionEndpoints) Add(ep *Endpoint)
func (*VersionEndpoints) Get ¶ added in v1.2.32
func (endpoints *VersionEndpoints) Get(id []byte) (ep *Endpoint)
func (*VersionEndpoints) Next ¶ added in v1.2.32
func (endpoints *VersionEndpoints) Next() (ep *Endpoint)
func (*VersionEndpoints) Remove ¶ added in v1.2.32
func (endpoints *VersionEndpoints) Remove(id []byte) (ok bool)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.