Documentation ¶
Index ¶
- Constants
- Variables
- func New(options Options) (manager services.EndpointsManager, shared shareds.Shared, ...)
- func NewBarrier(config BarrierConfig, shared shareds.Shared) (b barriers.Barrier)
- 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 Barrier
- type BarrierConfig
- type BarrierValue
- func (bv BarrierValue) Exist() bool
- func (bv BarrierValue) Failed(v error) (n BarrierValue)
- func (bv BarrierValue) Forget() BarrierValue
- func (bv BarrierValue) Forgot() bool
- func (bv BarrierValue) Succeed(v interface{}) (n BarrierValue, err error)
- func (bv BarrierValue) Value() (data []byte, err error)
- 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) 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) 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
- 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) Shutdown(ctx context.Context)
- type Node
- type NodeEvent
- type NodeEventKind
- type Nodes
- type Options
- type Registration
- func (registration *Registration) Add(endpoint *Endpoint)
- func (registration *Registration) Get(id []byte) (endpoint *Endpoint, has bool)
- func (registration *Registration) MaxOne() (endpoint *Endpoint, has bool)
- func (registration *Registration) Range(interval versions.Interval) (endpoint *Endpoint, has bool)
- func (registration *Registration) Remove(id string)
- type Registrations
- type RequestBody
- type ResponseBody
- type Service
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 NewBarrier ¶
func NewBarrier(config BarrierConfig, shared shareds.Shared) (b barriers.Barrier)
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 Barrier ¶
type Barrier struct {
// contains filtered or unexported fields
}
type BarrierConfig ¶
type BarrierValue ¶
type BarrierValue []byte
func NewBarrierValue ¶
func NewBarrierValue() BarrierValue
func (BarrierValue) Exist ¶
func (bv BarrierValue) Exist() bool
func (BarrierValue) Failed ¶
func (bv BarrierValue) Failed(v error) (n BarrierValue)
func (BarrierValue) Forget ¶
func (bv BarrierValue) Forget() BarrierValue
func (BarrierValue) Forgot ¶
func (bv BarrierValue) Forgot() bool
func (BarrierValue) Succeed ¶
func (bv BarrierValue) Succeed(v interface{}) (n BarrierValue, err error)
func (BarrierValue) Value ¶
func (bv BarrierValue) Value() (data []byte, err error)
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) 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 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)
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 (registration *Registration) Add(endpoint *Endpoint)
func (*Registration) Get ¶
func (registration *Registration) Get(id []byte) (endpoint *Endpoint, has bool)
func (*Registration) MaxOne ¶
func (registration *Registration) MaxOne() (endpoint *Endpoint, has bool)
func (*Registration) Range ¶
func (registration *Registration) Range(interval versions.Interval) (endpoint *Endpoint, has bool)
func (*Registration) Remove ¶
func (registration *Registration) Remove(id string)
type Registrations ¶
type Registrations []*Registration
func (Registrations) Add ¶
func (registrations Registrations) Add(endpoint *Endpoint) Registrations
func (Registrations) Get ¶
func (registrations Registrations) Get(name []byte) (v *Registration, has bool)
func (Registrations) Remove ¶
func (registrations Registrations) Remove(name string, id string) Registrations
type RequestBody ¶
type ResponseBody ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.