impl

package
v0.0.0-...-891ec84 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PiperFactory = &piperFactor{}
View Source
var TargetReplyer ctrl.TargetReplyer = &targetReplyer{}

Functions

This section is empty.

Types

type Hooks

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

func NewHooks

func NewHooks(sqlfilepath string) (*Hooks, error)

func (*Hooks) BeforeUseNew

func (h *Hooks) BeforeUseNew(o ctrl.Target, new ctrl.Target) error

type Piper

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

Piper implementaiton of ctrl.Piper

func (*Piper) Chat

func (p *Piper) Chat(s ctrl.Source, t ctrl.Target) error

Chat is send message form source to target and got the result

func (*Piper) WaitForChat

func (p *Piper) WaitForChat(s ctrl.Source) error

this function should be block the process and will return when source starting the chat

type Source

type Source struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Source) GetID

func (s *Source) GetID() uint32

type SourceFactory

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

func NewSourceFactory

func NewSourceFactory(urls string, h *pgconn.HijackedConn) (*SourceFactory, error)

func (*SourceFactory) New

func (sf *SourceFactory) New(c net.Conn) (ctrl.Source, error)

type Target

type Target struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Target) Release

func (t *Target) Release()

type TargetPool

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

func NewTargetPool

func NewTargetPool(oldurl, newurl string, useNew bool) (*TargetPool, error)

func (*TargetPool) Acquire

func (t *TargetPool) Acquire() (ctrl.Target, error)

fake implementation of acquire

func (*TargetPool) AcquireNew

func (t *TargetPool) AcquireNew() (ctrl.Target, error)

fake implementation of acquire new

func (*TargetPool) Close

func (t *TargetPool) Close() error

func (*TargetPool) HijackOne

func (t *TargetPool) HijackOne() (*pgconn.HijackedConn, func(), error)

func (*TargetPool) Release

func (t *TargetPool) Release(target *Target)

fake implementation of release

func (*TargetPool) Switch

func (t *TargetPool) Switch(new bool) error

Switch will switch the connection from old connection to new connection If we still have old connection alive until timeout, it should return error

func (*TargetPool) UseNew

func (t *TargetPool) UseNew() bool

UseNew should block if we in the switching progress

type TargetReader

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

TargetReader

func (*TargetReader) ReadTo

func (tr *TargetReader) ReadTo(s ctrl.Source) error

func (*TargetReader) SetTarget

func (tr *TargetReader) SetTarget(t ctrl.Target)

func (*TargetReader) StillChat

func (tr *TargetReader) StillChat() bool

Jump to

Keyboard shortcuts

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