fix: new implementation

changes:
- Remove cli
  Some cli commands are not complete tested and are deprecated.

- Daemon
  - Old version has a very bad implementation of how to verify, if the
    device or the sensors are in the database insert. The current
    implementation can be improved but this one is betten then the old
    one.
  - Remove complete the cache store implementation. Use a normal array
    and query the length and capacity to determine how the array cache
    must be cleaned.

- Type
  Remove unused types and functions
This commit is contained in:
2020-05-03 14:04:08 +02:00
parent 84d052184e
commit fb8d4dd5eb
137 changed files with 658 additions and 14048 deletions

View File

@ -1,16 +0,0 @@
package collect
func Errors(errorChannel <-chan error) []error {
errorList := make([]error, 0)
for {
select {
case err, more := <-errorChannel:
if more {
errorList = append(errorList, err)
continue
}
default:
return errorList
}
}
}

View File

@ -1,20 +0,0 @@
package collect
import (
"github.com/go-flucky/flucky/pkg/types"
)
func MeasuredValues(measuredValueChannel <-chan *types.MeasuredValue) []*types.MeasuredValue {
cachedMeasuredValues := make([]*types.MeasuredValue, 0)
for {
select {
case measuredValue, more := <-measuredValueChannel:
if more {
cachedMeasuredValues = append(cachedMeasuredValues, measuredValue)
continue
}
default:
return cachedMeasuredValues
}
}
}

View File

@ -1,30 +0,0 @@
package distribute
import (
"context"
"github.com/volker-raschek/flucky/pkg/types"
)
func MeasuredValues(ctx context.Context, channels int, inputChannel <-chan *types.MeasuredValue) []chan *types.MeasuredValue {
outputChannels := make([]chan *types.MeasuredValue, channels)
for i := 0; i <= channels; i++ {
outputChannel := make(chan *types.MeasuredValue)
outputChannels = append(outputChannels, outputChannel)
}
go func(ctx context.Context, inputChannel <-chan *types.MeasuredValue, outputChannels []chan *types.MeasuredValue) {
for {
select {
case <-ctx.Done():
return
case measuredValue, _ := <-inputChannel:
for _, outputChannel := range outputChannels {
outputChannel <- measuredValue
}
}
}
}(ctx, inputChannel, outputChannels)
return outputChannels
}

View File

@ -1,18 +0,0 @@
package prittyprint
import "fmt"
func FormatErrors(errors []error) error {
if len(errors) > 0 {
errMsg := ""
for i, err := range errors {
if i == 0 {
errMsg = fmt.Sprintf("%v", err.Error())
} else {
errMsg = fmt.Sprintf("%v\n%v", errMsg, err.Error())
}
}
return fmt.Errorf(errMsg)
}
return nil
}