metathings_device_service

package
v1.2.12-alpha0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SEND_RES_MAX_RETRY    = 16
	A_SEND_RES_INTERVAL   = float64(300)
	B_SEND_RES_INTERVAL   = float64(500)
	MAX_SEND_RES_INTERVAL = float64(3000)
)

Variables

View Source
var (
	ErrModuleNotFound              = errors.New("module not found")
	ErrInitializeConnectionTimeout = errors.New("initialize connection timeout")
	ErrConnectToSameNode           = errors.New("connect to same node")
	ErrExistedConnection           = errors.New("existed connection")
	ErrNoConnection                = errors.New("no connection")
)
View Source
var (
	ErrInvalidEndpoint          = errors.New("invalid endpoint")
	ErrInvalidModuleProxyDriver = errors.New("invalid module proxy driver")
)
View Source
var (
	PING_PKT = &deviced_pb.ConnectResponse{
		SessionId: 0,
		Kind:      deviced_pb.ConnectMessageKind_CONNECT_MESSAGE_KIND_SYSTEM,
		Union: &deviced_pb.ConnectResponse_UnaryCall{
			UnaryCall: &deviced_pb.UnaryCallValue{
				Name:      "system",
				Component: "system",
				Method:    "ping",
				Value:     nil,
			},
		},
	}
)

Functions

func IssueModuleTokenWithClient added in v1.0.0

func IssueModuleTokenWithClient(cli identityd2_pb.IdentitydServiceClient, ctx context.Context, credential_id string, timestamp time.Time, nonce int64, hmac string) (*identityd2_pb.Token, error)

Types

type MetathingsDeviceServiceImpl

type MetathingsDeviceServiceImpl struct {
	grpc_auth.ServiceAuthFuncOverride
	version_helper.Versioner
	*grpc_helper.ErrorParser
	// contains filtered or unexported fields
}

func (*MetathingsDeviceServiceImpl) GetObject

func (*MetathingsDeviceServiceImpl) GetObjectContent

func (*MetathingsDeviceServiceImpl) Heartbeat

func (*MetathingsDeviceServiceImpl) IsIgnoreMethod

func (*MetathingsDeviceServiceImpl) IssueModuleToken

func (*MetathingsDeviceServiceImpl) ListObjects

func (*MetathingsDeviceServiceImpl) PushFrameToFlow

func (*MetathingsDeviceServiceImpl) PushFrameToFlowOnce added in v1.2.9

func (self *MetathingsDeviceServiceImpl) PushFrameToFlowOnce(ctx context.Context, req *pb.PushFrameToFlowOnceRequest) (*empty.Empty, error)

func (*MetathingsDeviceServiceImpl) PutObject

func (*MetathingsDeviceServiceImpl) PutObjectStreaming added in v1.1.16

func (*MetathingsDeviceServiceImpl) RemoveObject

func (*MetathingsDeviceServiceImpl) RenameObject

func (*MetathingsDeviceServiceImpl) ShowModule

func (*MetathingsDeviceServiceImpl) ShowModuleFirmwareDescriptor added in v1.2.0

func (self *MetathingsDeviceServiceImpl) ShowModuleFirmwareDescriptor(ctx context.Context, _ *empty.Empty) (*pb.ShowModuleFirmwareDescriptorResponse, error)

func (*MetathingsDeviceServiceImpl) Start

func (self *MetathingsDeviceServiceImpl) Start() error

func (*MetathingsDeviceServiceImpl) Stop

func (self *MetathingsDeviceServiceImpl) Stop() error

type MetathingsDeviceServiceOption

type MetathingsDeviceServiceOption struct {
	InitConnectionTimeout  time.Duration
	NodenameRequestPeriod  time.Duration
	ModuleAliveTimeout     time.Duration
	HeartbeatInterval      time.Duration
	HeartbeatMaxRetry      int
	MaxReconnectInterval   time.Duration
	MinReconnectInterval   time.Duration
	PingInterval           time.Duration
	ExpectedConnections    int
	NewConnectionThreshold time.Duration
	NewConnectionPeriod    time.Duration
	ConnectToSameNode      bool
}

type Module

type Module interface {
	Id() string
	Heartbeat()
	IsAlive() bool
	HeartbeatAt() time.Time

	UnaryCall(ctx context.Context, req *deviced_pb.OpUnaryCallValue) (*deviced_pb.UnaryCallValue, error)
	StreamCall(ctx context.Context, cfg_req *deviced_pb.ConnectRequest, stm deviced_pb.DevicedService_ConnectClient) error
}

func NewModule

func NewModule(logger log.FieldLogger, module *deviced_pb.Module, alive_timeout time.Duration) Module

type ModuleDatabase

type ModuleDatabase interface {
	Lookup(name string) (Module, error)
	All() []Module
}

func NewModuleDatabase

func NewModuleDatabase(
	modules []*deviced_pb.Module,
	alive_timeout time.Duration,
	logger log.FieldLogger,
) ModuleDatabase

type ModuleDatabaseImpl

type ModuleDatabaseImpl struct {
	// contains filtered or unexported fields
}

func (*ModuleDatabaseImpl) All

func (self *ModuleDatabaseImpl) All() []Module

func (*ModuleDatabaseImpl) Lookup

func (self *ModuleDatabaseImpl) Lookup(name string) (Module, error)

type ModuleImpl

type ModuleImpl struct {
	// contains filtered or unexported fields
}

func (*ModuleImpl) Heartbeat

func (self *ModuleImpl) Heartbeat()

func (*ModuleImpl) HeartbeatAt

func (self *ModuleImpl) HeartbeatAt() time.Time

func (*ModuleImpl) Id

func (self *ModuleImpl) Id() string

func (*ModuleImpl) IsAlive

func (self *ModuleImpl) IsAlive() bool

func (*ModuleImpl) StreamCall

func (*ModuleImpl) UnaryCall

type ModuleStream

type ModuleStream interface {
	Send(*deviced_pb.OpStreamCallValue) error
	Recv() (*deviced_pb.StreamCallValue, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL