Documentation ¶
Overview ¶
Package matrix abstracts the source data as Plane, and then pixelates it into a matrix for display on the front end.
Index ¶
- func CheckPartOf(src, part []string)
- func CheckReduceOf(src, part []string)
- func GetLastKey(keys []string) string
- func KeysRange(keys []string, startKey string, endKey string) (start, end int, ok bool)
- func MakeKeys(keySet map[string]struct{}) []string
- func MakeKeysWithUnlimitedEnd(keySet map[string]struct{}) []string
- func Max(a, b int) int
- func MemsetInt(slice []int, v int)
- func MemsetUint64(slice []uint64, v uint64)
- func Min(a, b int) int
- type Axis
- type KeyMap
- type Matrix
- type NaiveLabelStrategy
- type Plane
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPartOf ¶
func CheckPartOf(src, part []string)
CheckPartOf checks that part keys are a subset of src keys.
func CheckReduceOf ¶
func CheckReduceOf(src, part []string)
CheckReduceOf checks that part keys are a subset of src keys and have the same StartKey and EndKey.
func MakeKeysWithUnlimitedEnd ¶
MakeKeysWithUnlimitedEnd uses a key set to build a new Key-Axis, then add a "" to the keys, indicating that the last bucket has an unlimited end.
func MemsetUint64 ¶
MemsetUint64 sets all elements of the uint64 slice to v.
Types ¶
type Axis ¶
Axis stores consecutive buckets. Each bucket has StartKey, EndKey, and some statistics. The EndKey of each bucket is the StartKey of its next bucket. The actual data structure is stored in columns. Therefore satisfies: len(Keys) == len(ValuesList[i]) + 1. In particular, ValuesList[0] is the base column.
func CreateAxis ¶
CreateAxis checks the given parameters and uses them to build the Axis.
func CreateEmptyAxis ¶
CreateEmptyAxis constructs a minimal empty Axis with the given parameters.
func (*Axis) Divide ¶
Divide uses the base column as the chunk for the Divide operation to obtain the partitioning scheme, and uses this to reduce other columns.
func (*Axis) Focus ¶
Focus uses the base column as the chunk for the Focus operation to obtain the partitioning scheme, and uses this to reduce other columns.
type Matrix ¶
type Matrix struct { Keys []string `json:"-"` DataMap map[string][][]uint64 `json:"data" binding:"required"` KeyAxis []decorator.LabelKey `json:"keyAxis" binding:"required"` TimeAxis []int64 `json:"timeAxis" binding:"required"` }
Matrix is the front end displays the required data.
func CreateMatrix ¶
CreateMatrix uses the specified times and keys to build an initial matrix with no data.
type NaiveLabelStrategy ¶
type NaiveLabelStrategy struct{}
NaiveLabelStrategy is one of the simplest LabelStrategy.
func (NaiveLabelStrategy) Background ¶
func (s NaiveLabelStrategy) Background()
Background do nothing.
func (NaiveLabelStrategy) CrossBorder ¶
func (s NaiveLabelStrategy) CrossBorder(startKey, endKey string) bool
CrossBorder always returns false. So NaiveLabelStrategy believes that there are no cross-border situations.
type Plane ¶
Plane stores consecutive axes. Each axis has StartTime, EndTime. The EndTime of each axis is the StartTime of its next axis. Therefore satisfies: len(Times) == len(Axes) + 1
func CreateEmptyPlane ¶
func CreateEmptyPlane(startTime, endTime time.Time, startKey, endKey string, valuesListLen int) Plane
CreateEmptyPlane constructs a minimal empty Plane with the given parameters.
func CreatePlane ¶
CreatePlane checks the given parameters and uses them to build the Plane.
type Strategy ¶
type Strategy interface { decorator.LabelStrategy // contains filtered or unexported methods }
Strategy is part of the customizable strategy in Matrix generation.
func AverageStrategy ¶
func AverageStrategy(label decorator.LabelStrategy) Strategy
AverageStrategy adopts the strategy of equal distribution when buckets are split.
func DistanceStrategy ¶
func DistanceStrategy(ctx context.Context, wg *sync.WaitGroup, label decorator.LabelStrategy, ratio float64, level int, count int) Strategy
DistanceStrategy adopts the strategy that the closer the split time is to the current time, the more traffic is allocated, when buckets are split.