strategy

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package strategy defines different route strategy mode.

Index

Constants

View Source
const (
	SingleReadWriteMode       = "single-read-write"
	LocalReadSingleWriteMode  = "local-read-single-write"
	SingleReadDoubleWriteMode = "single-read-async-double-write"
	LocalReadDoubleWriteMode  = "local-read-async-double-write"
)

Variables

This section is empty.

Functions

func IsWriteCommand added in v1.0.4

func IsWriteCommand(funcName string, args []interface{}) bool

Types

type CommandType added in v1.0.4

type CommandType int32
const (
	CommandTypeRead CommandType = iota
	CommandTypeWrite
	CommandTypeMulti
	CommandTypeOther
)

type DoubleWriteStrategy

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

func (*DoubleWriteStrategy) AfterProcess

func (d *DoubleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*DoubleWriteStrategy) AfterProcessPipeline

func (d *DoubleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*DoubleWriteStrategy) BeforeProcess

func (d *DoubleWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*DoubleWriteStrategy) BeforeProcessPipeline

func (d *DoubleWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

func (*DoubleWriteStrategy) Close

func (a *DoubleWriteStrategy) Close() error

func (*DoubleWriteStrategy) RouteClient

func (d *DoubleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient

func (*DoubleWriteStrategy) Watch

func (d *DoubleWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error

type LocalReadSingleWriteStrategy

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

func (*LocalReadSingleWriteStrategy) AfterProcess

func (a *LocalReadSingleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*LocalReadSingleWriteStrategy) AfterProcessPipeline

func (a *LocalReadSingleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*LocalReadSingleWriteStrategy) BeforeProcess

func (a *LocalReadSingleWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*LocalReadSingleWriteStrategy) BeforeProcessPipeline

func (a *LocalReadSingleWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

func (*LocalReadSingleWriteStrategy) Close

func (a *LocalReadSingleWriteStrategy) Close() error

func (*LocalReadSingleWriteStrategy) RouteClient

func (l *LocalReadSingleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient

func (*LocalReadSingleWriteStrategy) Watch

func (l *LocalReadSingleWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error

type SingelReadDoubleWriteStrategy added in v1.0.4

type SingelReadDoubleWriteStrategy struct {
	DoubleWriteStrategy
}

func (*SingelReadDoubleWriteStrategy) AfterProcess added in v1.0.4

func (d *SingelReadDoubleWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*SingelReadDoubleWriteStrategy) AfterProcessPipeline added in v1.0.4

func (d *SingelReadDoubleWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*SingelReadDoubleWriteStrategy) BeforeProcess added in v1.0.4

func (d *SingelReadDoubleWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*SingelReadDoubleWriteStrategy) BeforeProcessPipeline added in v1.0.4

func (d *SingelReadDoubleWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

func (*SingelReadDoubleWriteStrategy) Close added in v1.0.4

func (a *SingelReadDoubleWriteStrategy) Close() error

func (*SingelReadDoubleWriteStrategy) RouteClient added in v1.0.4

func (d *SingelReadDoubleWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient

func (*SingelReadDoubleWriteStrategy) Watch added in v1.0.4

func (d *SingelReadDoubleWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error

type SingleReadWriteStrategy

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

func (*SingleReadWriteStrategy) AfterProcess

func (a *SingleReadWriteStrategy) AfterProcess(ctx context.Context, cmd redis.Cmder) error

func (*SingleReadWriteStrategy) AfterProcessPipeline

func (a *SingleReadWriteStrategy) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error

func (*SingleReadWriteStrategy) BeforeProcess

func (a *SingleReadWriteStrategy) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)

func (*SingleReadWriteStrategy) BeforeProcessPipeline

func (a *SingleReadWriteStrategy) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)

func (*SingleReadWriteStrategy) Close

func (a *SingleReadWriteStrategy) Close() error

func (*SingleReadWriteStrategy) RouteClient

func (s *SingleReadWriteStrategy) RouteClient(opType CommandType) redis.UniversalClient

func (*SingleReadWriteStrategy) Watch

func (s *SingleReadWriteStrategy) Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error

type StrategyMode

type StrategyMode interface {
	RouteClient(opType CommandType) redis.UniversalClient
	Close() error
	Watch(ctx context.Context, fn func(*redis.Tx) error, keys ...string) error
}

func NewStrategy

func NewStrategy(configuration *config.Configuration) StrategyMode

Jump to

Keyboard shortcuts

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