Documentation ¶
Index ¶
- Variables
- func NewDefaultModuleOption() objx.Map
- func ToModule(v **Module) func(string, interface{}) error
- type Endpoint
- type FrameStream
- type GrpcModuleProxy
- type GrpcModuleProxyFactory
- type GrpcModuleServer
- type GrpcModuleServiceClientFactory
- type GrpcModuleServiceClientFactoryImpl
- type GrpcModuleWrapper
- type Kernel
- func (k *Kernel) Config() *KernelConfig
- func (k *Kernel) Context() context.Context
- func (k *Kernel) GetObject(name string) (*deviced_pb.Object, error)
- func (k *Kernel) GetObjectContent(name string) ([]byte, error)
- func (k *Kernel) Heartbeat() error
- func (k *Kernel) NewFrameStream(flow string) (*FrameStream, error)
- func (k *Kernel) PutObject(name string, content io.Reader) error
- func (k *Kernel) PutObjectStreaming(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) error
- func (k *Kernel) PutObjectStreamingWithCancel(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) (cancel context.CancelFunc, errs chan error, err error)
- func (k *Kernel) PutObjects(objects map[string]io.Reader) error
- func (k *Kernel) RemoveObject(name string) error
- func (k *Kernel) RemoveObjects(names []string) error
- func (k *Kernel) RenameObject(src, dst string) error
- func (k *Kernel) Show() (*deviced_pb.Module, error)
- func (k *Kernel) ShowFirmwareDescriptor() (*deviced_pb.FirmwareDescriptor, error)
- type KernelConfig
- type Module
- func (m *Module) GetObject(name string) (*deviced_pb.Object, error)
- func (m *Module) GetObjectContent(name string) ([]byte, error)
- func (m *Module) HeartbeatLoop()
- func (m *Module) Init() error
- func (m *Module) Kernel() *Kernel
- func (m *Module) Launch() error
- func (m *Module) Logger() log.FieldLogger
- func (m *Module) Name() string
- func (m *Module) PutObject(name string, content io.Reader) error
- func (m *Module) PutObjectStreaming(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) error
- func (m *Module) PutObjectStreamingWithCancel(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) (context.CancelFunc, chan error, error)
- func (m *Module) PutObjects(objects map[string]io.Reader) error
- func (m *Module) RemoveObject(name string) error
- func (m *Module) RemoveObjects(names []string) error
- func (m *Module) RenameObject(src, dst string) error
- func (m *Module) Serve() error
- func (m *Module) Stop()
- func (m *Module) Target() interface{}
- func (m *Module) WithNamespace(name string) string
- type ModuleOption
- type ModuleProxy
- type ModuleProxyFactory
- type ModuleProxyStream
- type ModuleServer
- type ModuleServerFactory
- type ModuleServiceInitializer
- type ModuleServiceLookuper
- type MqttModuleProxy
- type MqttModuleProxyFactory
- type MqttModuleProxyOption
- type NewKernelOption
- type NewModuleOption
- type PutObjectStreamingOption
- type ServiceEndpoint
- type TransportCredential
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnaryCallTimeout = errors.New("unary call timeout") ErrStreamCallConfigAckTimeout = errors.New("stream call config ack timeout") ErrStreamCallConfig = errors.New("stream call config error") ErrUnexceptedResponse = errors.New("unexpected response") ErrBadScheme = errors.New("bad scheme") ErrBadServiceEndpoint = errors.New("bad service endpoint") ErrDefaultAddressRequired = errors.New("default address required") ErrDeviceAddressRequired = errors.New("device address required") ErrInvalidArguments = errors.New("invalid arguments") ErrSubscribedSession = errors.New("subscribed session") ErrUnsubscribedSession = errors.New("unsubscribed session") ErrStartTimeout = errors.New("start timeout") )
View Source
var ( MQTT_UPSTREAM = "upstream" MQTT_DOWNSTREAM = "downstream" )
View Source
var (
ErrHandleUnimplemented = errors.New("handle unimplemented")
)
View Source
var (
ErrUnknownModuleProxyDriver = errors.New("unknown module proxy driver")
)
View Source
var (
ErrUnknownModuleServerAdapter = errors.New("unknown module server adapter")
)
Functions ¶
func NewDefaultModuleOption ¶ added in v1.2.0
Types ¶
type Endpoint ¶ added in v1.0.0
func ParseEndpoint ¶ added in v1.0.0
func (*Endpoint) GetTransportProtocol ¶ added in v1.0.0
func (*Endpoint) IsMetathingsProtocol ¶ added in v1.0.0
type FrameStream ¶ added in v1.1.0
type FrameStream struct {
// contains filtered or unexported fields
}
func (*FrameStream) Close ¶ added in v1.1.0
func (fs *FrameStream) Close() error
func (*FrameStream) Push ¶ added in v1.1.0
func (fs *FrameStream) Push(dat interface{}) error
func (*FrameStream) PushFrame ¶ added in v1.1.0
func (fs *FrameStream) PushFrame(frm *deviced_pb.OpFrame) error
type GrpcModuleProxy ¶
type GrpcModuleProxy struct {
// contains filtered or unexported fields
}
func (*GrpcModuleProxy) Close ¶ added in v1.0.0
func (self *GrpcModuleProxy) Close() error
func (*GrpcModuleProxy) StreamCall ¶
func (self *GrpcModuleProxy) StreamCall(ctx context.Context, method string, upstm ModuleProxyStream) error
type GrpcModuleProxyFactory ¶
type GrpcModuleProxyFactory struct{}
func (*GrpcModuleProxyFactory) NewModuleProxy ¶
func (self *GrpcModuleProxyFactory) NewModuleProxy(args ...interface{}) (ModuleProxy, error)
type GrpcModuleServer ¶
type GrpcModuleServer struct {
// contains filtered or unexported fields
}
func (*GrpcModuleServer) Serve ¶
func (s *GrpcModuleServer) Serve() error
func (*GrpcModuleServer) Stop ¶
func (s *GrpcModuleServer) Stop()
type GrpcModuleServiceClientFactory ¶
type GrpcModuleServiceClientFactory interface {
NewModuleServiceClient(opts ...grpc.DialOption) (pb.ModuleServiceClient, client_helper.CloseFn, error)
}
func NewGrpcModuleServiceClientFactory ¶
func NewGrpcModuleServiceClientFactory(addr string) GrpcModuleServiceClientFactory
type GrpcModuleServiceClientFactoryImpl ¶
type GrpcModuleServiceClientFactoryImpl struct {
Address string
}
func (*GrpcModuleServiceClientFactoryImpl) NewModuleServiceClient ¶
func (self *GrpcModuleServiceClientFactoryImpl) NewModuleServiceClient(opts ...grpc.DialOption) (pb.ModuleServiceClient, client_helper.CloseFn, error)
type GrpcModuleWrapper ¶
type GrpcModuleWrapper struct {
// contains filtered or unexported fields
}
func NewGrpcModuleWrapper ¶
func NewGrpcModuleWrapper(target interface{}, logger log.FieldLogger) *GrpcModuleWrapper
func (*GrpcModuleWrapper) StreamCall ¶
func (self *GrpcModuleWrapper) StreamCall(upstm pb.ModuleService_StreamCallServer) error
func (*GrpcModuleWrapper) UnaryCall ¶
func (self *GrpcModuleWrapper) UnaryCall(ctx context.Context, req *pb.UnaryCallRequest) (*pb.UnaryCallResponse, error)
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
func NewKernel ¶
func NewKernel(opt *NewKernelOption) (*Kernel, error)
func (*Kernel) Config ¶
func (k *Kernel) Config() *KernelConfig
func (*Kernel) NewFrameStream ¶ added in v1.1.0
func (k *Kernel) NewFrameStream(flow string) (*FrameStream, error)
func (*Kernel) PutObjectStreaming ¶ added in v1.1.16
func (k *Kernel) PutObjectStreaming(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) error
func (*Kernel) PutObjectStreamingWithCancel ¶ added in v1.1.16
func (k *Kernel) PutObjectStreamingWithCancel(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) (cancel context.CancelFunc, errs chan error, err error)
func (*Kernel) RemoveObject ¶
func (*Kernel) RemoveObjects ¶
func (*Kernel) RenameObject ¶
func (*Kernel) ShowFirmwareDescriptor ¶ added in v1.2.0
func (k *Kernel) ShowFirmwareDescriptor() (*deviced_pb.FirmwareDescriptor, error)
type KernelConfig ¶
func NewKernelConfigFromText ¶
func NewKernelConfigFromText(text string) (*KernelConfig, error)
func (*KernelConfig) Raw ¶
func (kc *KernelConfig) Raw() *viper.Viper
func (*KernelConfig) Sub ¶
func (kc *KernelConfig) Sub(key string) *KernelConfig
type Module ¶
type Module struct { version_helper.Versioner // contains filtered or unexported fields }
func NewModule ¶
func NewModule(name string, target interface{}, opts ...NewModuleOption) (*Module, error)
func (*Module) HeartbeatLoop ¶
func (m *Module) HeartbeatLoop()
func (*Module) Logger ¶
func (m *Module) Logger() log.FieldLogger
func (*Module) PutObjectStreaming ¶ added in v1.1.16
func (m *Module) PutObjectStreaming(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) error
func (*Module) PutObjectStreamingWithCancel ¶ added in v1.1.16
func (m *Module) PutObjectStreamingWithCancel(name string, content io.ReadSeeker, opt *PutObjectStreamingOption) (context.CancelFunc, chan error, error)
func (*Module) RemoveObject ¶
func (*Module) RemoveObjects ¶
func (*Module) RenameObject ¶
func (*Module) WithNamespace ¶
type ModuleOption ¶
type ModuleOption struct { Config string CredentialId string CredentialSecret string ServiceEndpoints map[string]ServiceEndpoint TransportCredential TransportCredential }
type ModuleProxy ¶
type ModuleProxy interface { UnaryCall(ctx context.Context, method string, req *any.Any) (*any.Any, error) StreamCall(ctx context.Context, method string, stm ModuleProxyStream) error Close() error }
func NewModuleProxy ¶
func NewModuleProxy(name string, args ...interface{}) (ModuleProxy, error)
type ModuleProxyFactory ¶
type ModuleProxyFactory interface {
NewModuleProxy(args ...interface{}) (ModuleProxy, error)
}
type ModuleProxyStream ¶
type ModuleProxyStream interface { Send(*any.Any) error Recv() (*any.Any, error) grpc.ClientStream }
func NewModuleProxyStream ¶
func NewModuleProxyStream(stm deviced_pb.DevicedService_ConnectClient, session int64) ModuleProxyStream
type ModuleServer ¶
type ModuleServer interface { Stop() Serve() error }
func NewGrpcModuleServer ¶
func NewGrpcModuleServer(m *Module) (ModuleServer, error)
func NewModuleServer ¶
func NewModuleServer(name string, mdl *Module) (ModuleServer, error)
type ModuleServerFactory ¶
type ModuleServerFactory func(*Module) (ModuleServer, error)
type ModuleServiceLookuper ¶
type ModuleServiceLookuper interface { LookupUnaryCall() LookupStreamCall() }
type MqttModuleProxy ¶ added in v1.0.0
type MqttModuleProxy struct {
// contains filtered or unexported fields
}
func (*MqttModuleProxy) Close ¶ added in v1.0.0
func (p *MqttModuleProxy) Close() error
func (*MqttModuleProxy) StreamCall ¶ added in v1.0.0
func (p *MqttModuleProxy) StreamCall(ctx context.Context, method string, upstm ModuleProxyStream) error
type MqttModuleProxyFactory ¶ added in v1.0.0
type MqttModuleProxyFactory struct{}
func (*MqttModuleProxyFactory) NewModuleProxy ¶ added in v1.0.0
func (f *MqttModuleProxyFactory) NewModuleProxy(args ...interface{}) (ModuleProxy, error)
type MqttModuleProxyOption ¶ added in v1.0.0
type MqttModuleProxyOption struct { Module struct { Id string } Session struct { Id int64 } Config struct { UnaryCallTimeout time.Duration StreamCallConfigAckTimeout time.Duration MQTTConnectTimeout time.Duration MQTTDisconnectTimeout time.Duration } MQTT struct { Address string Username string Password string ClientId string QoS byte } }
type NewKernelOption ¶
type NewKernelOption struct { Credential struct { Id string Secret string } TransportCredential TransportCredential ServiceEndpoints map[string]ServiceEndpoint ConfigText string }
type NewModuleOption ¶ added in v1.2.0
func SetVersion ¶ added in v1.2.0
func SetVersion(v string) NewModuleOption
type PutObjectStreamingOption ¶ added in v1.1.16
func NewPutObjectStreamingOptionFromPath ¶ added in v1.1.16
func NewPutObjectStreamingOptionFromPath(path string) (*PutObjectStreamingOption, error)
type ServiceEndpoint ¶ added in v1.1.10
type ServiceEndpoint struct { TransportCredential `mapstructure:",squash"` Address string }
Click to show internal directories.
Click to hide internal directories.