metathings_device_cloud_storage

package
v1.1.27 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStorageDriver        = errors.New("invalid storage driver")
	ErrConnectedByOtherDeviceCloud = errors.New("connected by other device cloud")
	ErrNotConnected                = errors.New("not connected")

	NOTIME = time.Unix(0, 0)
)

Functions

This section is empty.

Types

type RedisStorage

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

func (*RedisStorage) GetDeviceConnectSession

func (s *RedisStorage) GetDeviceConnectSession(dev_id string) (string, error)

func (*RedisStorage) GetHeartbeatAt

func (s *RedisStorage) GetHeartbeatAt(mdl_id string) (time.Time, error)

func (*RedisStorage) GetModuleSession

func (s *RedisStorage) GetModuleSession(mdl_id string) (int64, error)

func (*RedisStorage) Heartbeat

func (s *RedisStorage) Heartbeat(mdl_id string) error

func (*RedisStorage) IsDeviceConnectSession

func (s *RedisStorage) IsDeviceConnectSession(dev_id string, sess string) error

func (*RedisStorage) SetDeviceConnectSession

func (s *RedisStorage) SetDeviceConnectSession(dev_id string, sess string) error

func (*RedisStorage) SetModuleSession

func (s *RedisStorage) SetModuleSession(mdl_id string, sess int64) error

func (*RedisStorage) UnsetDeviceConnectSession

func (s *RedisStorage) UnsetDeviceConnectSession(dev_id string, sess string) error

func (*RedisStorage) UnsetModuleSession added in v1.1.22

func (s *RedisStorage) UnsetModuleSession(mdl_id string) error

type RedisStorageFactory

type RedisStorageFactory struct{}

func (*RedisStorageFactory) New

func (f *RedisStorageFactory) New(args ...interface{}) (Storage, error)

type RedisStorageOption

type RedisStorageOption struct {
	Module struct {
		Session struct {
			Timeout time.Duration
		}
	}
	Device struct {
		Session struct {
			Timeout time.Duration
		}
	}
	Redis struct {
		Address  string
		Password string
		Db       int
		Pool     struct {
			Init int
			Max  int
		}
	}
}

type Storage

type Storage interface {
	Heartbeat(mdl_id string) error
	GetHeartbeatAt(mdl_id string) (time.Time, error)
	SetModuleSession(mdl_id string, sess int64) error
	UnsetModuleSession(mdl_id string) error
	GetModuleSession(mdl_id string) (int64, error)
	SetDeviceConnectSession(dev_id string, sess string) error
	UnsetDeviceConnectSession(dev_id string, sess string) error
	GetDeviceConnectSession(dev_id string) (string, error)
}

func NewStorage

func NewStorage(name string, args ...interface{}) (Storage, error)

type StorageFactory

type StorageFactory interface {
	New(args ...interface{}) (Storage, error)
}

Jump to

Keyboard shortcuts

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