wrapper

package
v2.1.0-rc.1+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LocalIP                      string
	MinWriteAbleDataPartitionCnt = 10
)

Functions

This section is empty.

Types

type DataPartition

type DataPartition struct {
	// Will not be changed
	proto.DataPartitionResponse
	RandomWrite   bool
	PartitionType string
	ClientWrapper *Wrapper
	Metrics       *DataPartitionMetrics
}

DataPartition defines the wrapper of the data partition.

func (*DataPartition) CheckAllHostsIsAvail added in v1.4.0

func (dp *DataPartition) CheckAllHostsIsAvail(exclude map[string]struct{})

func (*DataPartition) GetAllAddrs

func (dp *DataPartition) GetAllAddrs() string

GetAllAddrs returns the addresses of all the replicas of the data partition.

func (*DataPartition) String

func (dp *DataPartition) String() string

String returns the string format of the data partition.

type DataPartitionMetrics

type DataPartitionMetrics struct {
	WriteLatency float64
	ReadLatency  float64
}

DataPartitionMetrics defines the wrapper of the metrics related to the data partition.

func NewDataPartitionMetrics

func NewDataPartitionMetrics() *DataPartitionMetrics

NewDataPartitionMetrics returns a new DataPartitionMetrics instance.

type DataPartitionSorter

type DataPartitionSorter []*DataPartition

func (DataPartitionSorter) Len

func (ds DataPartitionSorter) Len() int

func (DataPartitionSorter) Less

func (ds DataPartitionSorter) Less(i, j int) bool

func (DataPartitionSorter) Swap

func (ds DataPartitionSorter) Swap(i, j int)

type DataPartitionView

type DataPartitionView struct {
	DataPartitions []*DataPartition
}

type Wrapper

type Wrapper struct {
	sync.RWMutex

	HostsStatus map[string]bool
	// contains filtered or unexported fields
}

Wrapper TODO rename. This name does not reflect what it is doing.

func NewDataPartitionWrapper

func NewDataPartitionWrapper(volName string, masters []string) (w *Wrapper, err error)

NewDataPartitionWrapper returns a new data partition wrapper.

func (*Wrapper) FollowerRead added in v1.4.0

func (w *Wrapper) FollowerRead() bool

func (*Wrapper) GetDataPartition

func (w *Wrapper) GetDataPartition(partitionID uint64) (*DataPartition, error)

GetDataPartition returns the data partition based on the given partition ID.

func (*Wrapper) GetDataPartitionForWrite

func (w *Wrapper) GetDataPartitionForWrite(exclude map[string]struct{}) (*DataPartition, error)

GetDataPartitionForWrite returns an available data partition for write.

func (*Wrapper) Stop

func (w *Wrapper) Stop()

func (*Wrapper) WarningMsg

func (w *Wrapper) WarningMsg() string

WarningMsg returns the warning message that contains the cluster name.

Jump to

Keyboard shortcuts

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