Documentation
¶
Index ¶
- Constants
- Variables
- func AddEtcdMember(client *clientv3.Client, urls []string) (*clientv3.MemberAddResponse, error)
- func CheckClusterID(localClusterID types.ID, um types.URLsMap) error
- func DecodeGroupKey(key string) uint64
- func DefaultTimeoutWheel() *timewheel.TimeoutWheel
- func EmptyPeer(value metapb.Replica) bool
- func EncodeGroupKey(group uint64, rules []metapb.ScheduleGroupRule, labels []metapb.Pair) string
- func FindPeer(peers []*metapb.Replica, containerID uint64) (metapb.Replica, bool)
- func GeometricMean(input Float64Data) (float64, error)
- func GetCurrentClusterMembers(client *clientv3.Client) (*clientv3.MemberListResponse, error)
- func GetEtcdResp(client *clientv3.Client, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
- func GetEtcdValue(client *clientv3.Client, key string, opts ...clientv3.OpOption) ([]byte, int64, error)
- func HarmonicMean(input Float64Data) (float64, error)
- func IsNotLeaderError(err string) bool
- func LeaderTxn(client *clientv3.Client, leaderKey, leaderValue string, cs ...clientv3.Cmp) clientv3.Txn
- func ListEtcdMembers(client *clientv3.Client) (*clientv3.MemberListResponse, error)
- func Max(input Float64Data) (max float64, err error)
- func MaxUint64(a, b uint64) uint64
- func Mean(input Float64Data) (float64, error)
- func Median(input Float64Data) (median float64, err error)
- func Min(input Float64Data) (min float64, err error)
- func MinBalanceDiff(count uint64) float64
- func MinDuration(a, b time.Duration) time.Duration
- func MinUint64(a, b uint64) uint64
- func Mode(input Float64Data) (mode []float64, err error)
- func MustMarshalBM64(bm *roaring64.Bitmap) []byte
- func MustMarshalBM64To(bm *roaring64.Bitmap, buf *bytes.Buffer)
- func MustUnmarshalBM64(data []byte) *roaring64.Bitmap
- func MustUnmarshalBM64To(data []byte, bm *roaring64.Bitmap)
- func ParseUrls(s string) ([]url.URL, error)
- func PopulationVariance(input Float64Data) (pvar float64, err error)
- func PutEtcdWithTTL(ctx context.Context, c *clientv3.Client, key string, value string, ...) (*clientv3.PutResponse, error)
- func StandardDeviation(input Float64Data) (sdev float64, err error)
- func StandardDeviationPopulation(input Float64Data) (sdev float64, err error)
- func Sum(input Float64Data) (sum float64, err error)
- func Txn(client *clientv3.Client) clientv3.Txn
- type Float64Data
- func (f Float64Data) Get(i int) float64
- func (f Float64Data) Len() int
- func (f Float64Data) Less(i, j int) bool
- func (f Float64Data) Max() (float64, error)
- func (f Float64Data) Mean() (float64, error)
- func (f Float64Data) Median() (float64, error)
- func (f Float64Data) Min() (float64, error)
- func (f Float64Data) Mode() ([]float64, error)
- func (f Float64Data) Sum() (float64, error)
- func (f Float64Data) Swap(i, j int)
- type TTLString
- func (c TTLString) Clear()
- func (c *TTLString) Get(id string) (interface{}, bool)
- func (c TTLString) Len() int
- func (c *TTLString) Pop() (string, interface{}, bool)
- func (c *TTLString) Put(key string, value interface{})
- func (c *TTLString) PutWithTTL(key string, value interface{}, ttl time.Duration)
- type TTLUint64
- func (c TTLUint64) Clear()
- func (c *TTLUint64) Exists(id uint64) bool
- func (c *TTLUint64) Get(id uint64) (interface{}, bool)
- func (c *TTLUint64) GetAllID() []uint64
- func (c TTLUint64) Len() int
- func (c *TTLUint64) Put(id uint64, value interface{})
- func (c *TTLUint64) PutWithTTL(key uint64, value interface{}, ttl time.Duration)
- func (c *TTLUint64) Remove(key uint64)
Constants ¶
const ( // UseSliceCount encode bitmap as Slice UseSliceCount = uint64(5) )
Variables ¶
var ( // ErrNotLeader error not leader ErrNotLeader = errors.New("election: not leader") // ErrNotBootstrapped not bootstrapped ErrNotBootstrapped = errors.New("prophet: not bootstrapped") // ErrReq invalid request ErrReq = errors.New("invalid req") // ErrStaleResource stale resource ErrStaleResource = errors.New("stale resource") // ErrTombstoneContainer t ombstone container ErrTombstoneContainer = errors.New("container is tombstone") // ErrSchedulerExisted error with scheduler is existed ErrSchedulerExisted = errors.New("scheduler is existed") // ErrSchedulerNotFound error with scheduler is not found ErrSchedulerNotFound = errors.New("scheduler is not found") )
var GetPrefixRangeEnd = clientv3.GetPrefixRangeEnd
GetPrefixRangeEnd get prefix range end
Functions ¶
func AddEtcdMember ¶
AddEtcdMember add a member to etcd
func CheckClusterID ¶
CheckClusterID checks etcd cluster ID, returns an error if mismatch. This function will never block even quorum is not satisfied.
func DecodeGroupKey ¶ added in v0.2.0
DecodeGroupKey decode group key, returns group id
func DefaultTimeoutWheel ¶
func DefaultTimeoutWheel() *timewheel.TimeoutWheel
DefaultTimeoutWheel returns default timeout wheel
func EncodeGroupKey ¶ added in v0.2.0
EncodeGroupKey encode group key
func GeometricMean ¶
func GeometricMean(input Float64Data) (float64, error)
GeometricMean gets the geometric mean for a slice of numbers
func GetCurrentClusterMembers ¶
func GetCurrentClusterMembers(client *clientv3.Client) (*clientv3.MemberListResponse, error)
GetCurrentClusterMembers returns etcd current members
func GetEtcdResp ¶
func GetEtcdResp(client *clientv3.Client, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
GetEtcdResp returns etcd resp
func GetEtcdValue ¶
func GetEtcdValue(client *clientv3.Client, key string, opts ...clientv3.OpOption) ([]byte, int64, error)
GetEtcdValue returns value from etcd storage
func HarmonicMean ¶
func HarmonicMean(input Float64Data) (float64, error)
HarmonicMean gets the harmonic mean for a slice of numbers
func LeaderTxn ¶
func LeaderTxn(client *clientv3.Client, leaderKey, leaderValue string, cs ...clientv3.Cmp) clientv3.Txn
LeaderTxn returns leader txn
func ListEtcdMembers ¶
func ListEtcdMembers(client *clientv3.Client) (*clientv3.MemberListResponse, error)
ListEtcdMembers returns etcd members
func Max ¶
func Max(input Float64Data) (max float64, err error)
Max finds the highest number in a slice
func Mean ¶
func Mean(input Float64Data) (float64, error)
Mean gets the average of a slice of numbers
func Median ¶
func Median(input Float64Data) (median float64, err error)
Median gets the median number in a slice of numbers
func Min ¶
func Min(input Float64Data) (min float64, err error)
Min finds the lowest number in a set of data
func MinBalanceDiff ¶
MinBalanceDiff returns the minimal diff to do balance. The formula is based on experience to let the diff increase alone with the count slowly.
func Mode ¶
func Mode(input Float64Data) (mode []float64, err error)
Mode gets the mode of a slice of numbers
func MustMarshalBM64 ¶
MustMarshalBM64 must marshal BM
func MustMarshalBM64To ¶
MustMarshalBM64To must marshal BM
func MustUnmarshalBM64 ¶
MustUnmarshalBM64 parse a bitmap
func MustUnmarshalBM64To ¶
MustUnmarshalBM64To parse a bitmap
func PopulationVariance ¶
func PopulationVariance(input Float64Data) (pvar float64, err error)
PopulationVariance finds the amount of variance within a population
func PutEtcdWithTTL ¶
func PutEtcdWithTTL(ctx context.Context, c *clientv3.Client, key string, value string, ttlSeconds int64) (*clientv3.PutResponse, error)
PutEtcdWithTTL put (key, value) into etcd with a ttl of ttlSeconds
func StandardDeviation ¶
func StandardDeviation(input Float64Data) (sdev float64, err error)
StandardDeviation the amount of variation in the dataset
func StandardDeviationPopulation ¶
func StandardDeviationPopulation(input Float64Data) (sdev float64, err error)
StandardDeviationPopulation finds the amount of variation from the population
func Sum ¶
func Sum(input Float64Data) (sum float64, err error)
Sum adds all the numbers of a slice together
Types ¶
type Float64Data ¶
type Float64Data []float64
Float64Data is a named type for []float64 with helper methods
func (Float64Data) Less ¶
func (f Float64Data) Less(i, j int) bool
Less returns if one number is less than another
func (Float64Data) Max ¶
func (f Float64Data) Max() (float64, error)
Max returns the maximum number in the data
func (Float64Data) Mean ¶
func (f Float64Data) Mean() (float64, error)
Mean returns the mean of the data
func (Float64Data) Median ¶
func (f Float64Data) Median() (float64, error)
Median returns the median of the data
func (Float64Data) Min ¶
func (f Float64Data) Min() (float64, error)
Min returns the minimum number in the data
func (Float64Data) Mode ¶
func (f Float64Data) Mode() ([]float64, error)
Mode returns the mode of the data
func (Float64Data) Sum ¶
func (f Float64Data) Sum() (float64, error)
Sum returns the total of all the numbers in the data
func (Float64Data) Swap ¶
func (f Float64Data) Swap(i, j int)
Swap switches out two numbers in slice
type TTLString ¶
type TTLString struct {
// contains filtered or unexported fields
}
TTLString is simple TTL saves key string and value.
func NewStringTTL ¶
NewStringTTL creates a new TTLString cache.
type TTLUint64 ¶
type TTLUint64 struct {
// contains filtered or unexported fields
}
TTLUint64 is simple TTL saves only uint64s.
func (*TTLUint64) PutWithTTL ¶
PutWithTTL puts an item into cache with specified TTL.