clients

package
v0.0.0-...-a1d8c0c Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAWSConfig

func NewAWSConfig() *aws.Config

func NewAWSSession

func NewAWSSession(config *aws.Config) *session.Session

func NewS3Client

func NewS3Client(session *session.Session) *s3.S3

func NewSFTPClient

func NewSFTPClient(sshClient *ssh.Client) (*sftp.Client, error)

func NewSSHClient

func NewSSHClient(host string, port uint32, sshConfig *ssh.ClientConfig) (*ssh.Client, error)

func NewSSHConfig

func NewSSHConfig(user string, password string) *ssh.ClientConfig

Types

type AWSManager

type AWSManager struct {
	S3Manager *S3Manager
	// contains filtered or unexported fields
}

func NewAWSManager

func NewAWSManager(session *session.Session) *AWSManager

type RedisConfig

type RedisConfig struct {
	Host string
	Port uint16
	DB   uint8
}

func (*RedisConfig) ToOption

func (rc *RedisConfig) ToOption() *redis.Options

type RedisManager

type RedisManager struct {
	Clients map[string][]*RedisWrapper
}

func NewRedisManager

func NewRedisManager() *RedisManager

func (*RedisManager) AddClient

func (rw *RedisManager) AddClient(config RedisConfig, category string, channel string, consumerName string) (*RedisWrapper, error)

func (*RedisManager) Close

func (rw *RedisManager) Close() error

func (*RedisManager) GetCategories

func (rw *RedisManager) GetCategories() (clientsCat []string)

type RedisWrapper

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

func NewRedisWrapper

func NewRedisWrapper(config RedisConfig, channel string, consumerName string) (*RedisWrapper, error)

func (*RedisWrapper) AckMessage

func (w *RedisWrapper) AckMessage(group string, ids ...string) (int64, error)

func (*RedisWrapper) AddMessage

func (w *RedisWrapper) AddMessage(data map[string]interface{}) (string, error)

func (*RedisWrapper) Close

func (w *RedisWrapper) Close() error

func (*RedisWrapper) CreateGroup

func (w *RedisWrapper) CreateGroup(group string, start string) (string, error)

func (*RedisWrapper) DeleteGroup

func (w *RedisWrapper) DeleteGroup(group string) (int64, error)

func (*RedisWrapper) DeleteGroupConsumer

func (w *RedisWrapper) DeleteGroupConsumer(group string) (int64, error)

func (*RedisWrapper) DeleteMessage

func (w *RedisWrapper) DeleteMessage(ids ...string) (int64, error)

func (*RedisWrapper) FlushAll

func (w *RedisWrapper) FlushAll() (string, error)

func (*RedisWrapper) FlushAllAsync

func (w *RedisWrapper) FlushAllAsync() (string, error)

func (*RedisWrapper) FlushDB

func (w *RedisWrapper) FlushDB() (string, error)

func (*RedisWrapper) FlushDBAsync

func (w *RedisWrapper) FlushDBAsync() (string, error)

func (*RedisWrapper) GetChannel

func (w *RedisWrapper) GetChannel() string

func (*RedisWrapper) PendingMessage

func (w *RedisWrapper) PendingMessage(group string) (*redis.XPending, error)

func (*RedisWrapper) ReadGroupMessage

func (w *RedisWrapper) ReadGroupMessage(group string, count int64, block time.Duration, extraIds ...string) ([]redis.XStream, error)

func (*RedisWrapper) ReadMessage

func (w *RedisWrapper) ReadMessage(lastId string, count int64, block time.Duration) ([]redis.XStream, error)

func (*RedisWrapper) ReadRangeMessage

func (w *RedisWrapper) ReadRangeMessage(start string, stop string) ([]redis.XMessage, error)

type S3Manager

type S3Manager struct {
	S3 []StorageAccessLayer
	// contains filtered or unexported fields
}

func NewS3Manager

func NewS3Manager(session *session.Session) *S3Manager

func (*S3Manager) Add

func (sm *S3Manager) Add(bucketName string) *S3Wrapper

type S3Wrapper

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

S3 Adapter

func NewS3Wrapper

func NewS3Wrapper(bucketName string, s3Client *s3.S3) *S3Wrapper

func (*S3Wrapper) Upload

func (s3w *S3Wrapper) Upload(path string, filename string, data io.Reader) (string, error)

type SFTPManager

type SFTPManager struct {
	Conns []*SFTPWrapper
	// contains filtered or unexported fields
}

Manager SFTP connections structure

func NewSFTPManager

func NewSFTPManager(host string, port uint32, sshConfig *ssh.ClientConfig) *SFTPManager

SFTP Manager Construct

func (*SFTPManager) AddClient

func (sm *SFTPManager) AddClient() (*SFTPWrapper, error)

type SFTPWrapper

type SFTPWrapper struct {
	sync.Mutex

	Client *sftp.Client
	// contains filtered or unexported fields
}

SFTP connection (with clients)

func NewSFTPWrapper

func NewSFTPWrapper(sshClient *ssh.Client, sftpClient *sftp.Client) *SFTPWrapper

SFTP Wrapper Construct

func (*SFTPWrapper) Close

func (s *SFTPWrapper) Close() error

SFTP Wrapper Close connection => chan notify ssh connection to close

type StorageAccessLayer

type StorageAccessLayer interface {
	Upload(path string, filename string, data io.Reader) (string, error)
}

Storage Layer interface

Jump to

Keyboard shortcuts

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