Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45b3b258c1 | ||
|
|
a0fe455bce | ||
|
|
7b9641f753 | ||
|
|
3d3dab91b9 | ||
|
|
408700367b | ||
|
|
c1d822b296 | ||
|
|
fd835b67dc | ||
|
|
49d8d03d8a | ||
|
|
0a137c9d86 | ||
|
|
a1f947e24a | ||
|
|
3d1dee25f1 |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.DS_Store
|
||||||
|
*.dbm
|
||||||
|
*.log
|
||||||
36
args/args.go
Normal file
36
args/args.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package args
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
|
||||||
|
"github.com/tecamino/tecamino-dbm/cert"
|
||||||
|
"github.com/tecamino/tecamino-dbm/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Args struct {
|
||||||
|
Port models.Port
|
||||||
|
Cert cert.Cert
|
||||||
|
RootDir string
|
||||||
|
DBMFile string
|
||||||
|
Debug bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func Init() *Args {
|
||||||
|
|
||||||
|
a := Args{
|
||||||
|
Cert: cert.Cert{
|
||||||
|
Organization: *flag.String("org", "tecamino", "name of organization for certificate"),
|
||||||
|
CertFile: *flag.String("certFile", "./cert/cert.pem", "path of certfile"),
|
||||||
|
KeyFile: *flag.String("keyFile", "./cert/key.pem", "path of keyfile"),
|
||||||
|
},
|
||||||
|
Port: models.Port{
|
||||||
|
Http: *flag.Uint("http-port", 8100, "json server communication for http/ws"),
|
||||||
|
Https: *flag.Uint("https-port", 8101, "json server communication for http/wss"),
|
||||||
|
},
|
||||||
|
RootDir: *flag.String("workingDir", "./", "working directory"),
|
||||||
|
DBMFile: *flag.String("dbm", "/test/test", "dbm file name"),
|
||||||
|
Debug: *flag.Bool("debug", false, "debug flag"),
|
||||||
|
}
|
||||||
|
flag.Parse()
|
||||||
|
return &a
|
||||||
|
}
|
||||||
23
auth/auth.go
Normal file
23
auth/auth.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package auth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetIDFromAuth(c *gin.Context) (string, error) {
|
||||||
|
auth := c.GetHeader("Authorization")
|
||||||
|
if len(auth) > 7 && auth[:7] == "Bearer " {
|
||||||
|
return auth[7:], nil
|
||||||
|
}
|
||||||
|
return "", errors.New("authorization token missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetIDFromQuery(c *gin.Context) (string, error) {
|
||||||
|
auth, exists := c.GetQuery("id")
|
||||||
|
if !exists {
|
||||||
|
return "", errors.New("id missing")
|
||||||
|
}
|
||||||
|
return auth, nil
|
||||||
|
}
|
||||||
89
cert/cert.go
Normal file
89
cert/cert.go
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
package cert
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/rsa"
|
||||||
|
"crypto/x509"
|
||||||
|
"crypto/x509/pkix"
|
||||||
|
"encoding/pem"
|
||||||
|
"math/big"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Cert struct {
|
||||||
|
Organization string
|
||||||
|
CertFile string
|
||||||
|
KeyFile string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize a new ssl certificate handler with organization name
|
||||||
|
func NewCertHandler(org string) *Cert {
|
||||||
|
return &Cert{
|
||||||
|
Organization: org,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// generates a new self signed ssl certificate foe localhost and development use
|
||||||
|
func (c *Cert) GenerateSelfSignedCert() error {
|
||||||
|
|
||||||
|
// do not generate certs if they exist
|
||||||
|
// _, err := os.Stat(c.CertFile)
|
||||||
|
// _, err2 := os.Stat(c.KeyFile)
|
||||||
|
// if !os.IsNotExist(err) && !os.IsNotExist(err2) {
|
||||||
|
// return nil
|
||||||
|
// }
|
||||||
|
|
||||||
|
priv, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
serialNumber, _ := rand.Int(rand.Reader, big.NewInt(1<<62))
|
||||||
|
|
||||||
|
template := x509.Certificate{
|
||||||
|
SerialNumber: serialNumber,
|
||||||
|
Subject: pkix.Name{
|
||||||
|
CommonName: "localhost",
|
||||||
|
Organization: []string{c.Organization},
|
||||||
|
},
|
||||||
|
NotBefore: time.Now(),
|
||||||
|
NotAfter: time.Now().Add(365 * 24 * time.Hour),
|
||||||
|
|
||||||
|
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
|
||||||
|
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
||||||
|
BasicConstraintsValid: true,
|
||||||
|
DNSNames: []string{"localhost"},
|
||||||
|
}
|
||||||
|
|
||||||
|
certDER, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(path.Dir(c.CertFile)); os.IsNotExist(err) {
|
||||||
|
os.MkdirAll(path.Dir(c.CertFile), 0666)
|
||||||
|
}
|
||||||
|
|
||||||
|
certOut, err := os.Create(c.CertFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer certOut.Close()
|
||||||
|
pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: certDER})
|
||||||
|
|
||||||
|
if _, err := os.Stat(path.Dir(c.KeyFile)); os.IsNotExist(err) {
|
||||||
|
os.MkdirAll(path.Dir(c.KeyFile), 0666)
|
||||||
|
}
|
||||||
|
|
||||||
|
keyOut, err := os.Create(c.KeyFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer keyOut.Close()
|
||||||
|
|
||||||
|
pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
19
cert/cert.pem
Normal file
19
cert/cert.pem
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDGzCCAgOgAwIBAgIIB2N9YzgUYFAwDQYJKoZIhvcNAQELBQAwJzERMA8GA1UE
|
||||||
|
ChMIdGVjYW1pbm8xEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0yNTA0MTYxNjE2NDJa
|
||||||
|
Fw0yNjA0MTYxNjE2NDJaMCcxETAPBgNVBAoTCHRlY2FtaW5vMRIwEAYDVQQDEwls
|
||||||
|
b2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDDFOsJDNRd
|
||||||
|
wX25lB1QGCFhvjK+yN/pZHNtjQvHOcajON+Fhm56RWKbuKR4BQdNWF/uWe/wH6kC
|
||||||
|
xrYXzuAqJIzB/trFZ14whNblxjjxSmGhkMNFFTIIIdTICcoQu3+zzXxUc4s9ni4R
|
||||||
|
uGXudFB7uSZBx5x2TWrdFzBIfAuWfQfCwMWqiDoTH09T7DxJJyuvKf4yNPyDq+oe
|
||||||
|
4WGEXCpk3VBjggqYDGknMUzreEEa8JaIuDMFhQz4J4A5QGZOHOEyaP839cDblY31
|
||||||
|
ot5Pd6PUAs5yvmvIZUCscW7bJH2vUqDC2tJ4WjkVkykULLIDIbe4Thi4//9oKzKV
|
||||||
|
fhP2TM9t+OeVAgMBAAGjSzBJMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggr
|
||||||
|
BgEFBQcDATAMBgNVHRMBAf8EAjAAMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkq
|
||||||
|
hkiG9w0BAQsFAAOCAQEANfjOOkU/fl7Y2pJ6V+qKv9vdBb4nEpiNOnSl8sSgZP4r
|
||||||
|
wa1ArfALCPY1Gu+XDrwqcVLii511xT4cFuegxaOdu2+5j4+WjIR9ke/AeEuyNU1X
|
||||||
|
mm/xgBOSibxqSWVHTGhLLY4jwyU3GYx+4ODNmLoQ2eNQ7NDsCDAQq+OAbR+f5486
|
||||||
|
j8AcrjEjWI5Nh9p4DiqEA1DwNCKnpYcw8QBiawNFli3mvFSu1KSTG5UGM8vwzCOu
|
||||||
|
nk2GtBvhDODVhDuM3BjqAmT7xbIJGXdW25+FG9++Vc+36LVSJVxMeOWx4u07Ggqk
|
||||||
|
4y39spP+xOzXegFCJXu+OkxjvZ7mRGaPp1zKeaoVVQ==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
27
cert/key.pem
Normal file
27
cert/key.pem
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpAIBAAKCAQEAwxTrCQzUXcF9uZQdUBghYb4yvsjf6WRzbY0LxznGozjfhYZu
|
||||||
|
ekVim7ikeAUHTVhf7lnv8B+pAsa2F87gKiSMwf7axWdeMITW5cY48UphoZDDRRUy
|
||||||
|
CCHUyAnKELt/s818VHOLPZ4uEbhl7nRQe7kmQcecdk1q3RcwSHwLln0HwsDFqog6
|
||||||
|
Ex9PU+w8SScrryn+MjT8g6vqHuFhhFwqZN1QY4IKmAxpJzFM63hBGvCWiLgzBYUM
|
||||||
|
+CeAOUBmThzhMmj/N/XA25WN9aLeT3ej1ALOcr5ryGVArHFu2yR9r1KgwtrSeFo5
|
||||||
|
FZMpFCyyAyG3uE4YuP//aCsylX4T9kzPbfjnlQIDAQABAoIBAAfekaahTyj8puMA
|
||||||
|
39489ifFVOW2U7X/nw2Y+Xpb0P2azAV//HfpOAbN5kopjCrC35SaKZNdq5ZllRXi
|
||||||
|
LgL1MeQBF5ElnNQtn6YDa4U5E2j0xOb5NmkpxQKDk2E+aj92EOEu2G78l24pxDVG
|
||||||
|
Zhkl/GGXheIna4hBdbZCCFoI1b9o4w1iFLsc1MJxDszRqxD5M9uZ4YMtI6rGrUtx
|
||||||
|
xAeYqSvEnMfYHRXbQlFhZF2F9suW+rsUpL264bQ7OPMNsQAtsu5Q9x1dEMuuj+NX
|
||||||
|
4Tavu78CyVGjBrBrCDJ0P/r/EyK72n8noZBto+Xzk4S3PjxWfb0HVsHYVaeq2O+I
|
||||||
|
3et0C+cCgYEA8fd9NB31KU2sjJtNWBq7Vs/6F6IPlZat6FCHFDjt0wCm9LK0gMii
|
||||||
|
l79mJyKwI3i2K3HKVDrpuplYBJ9Z7XQCQin6844Bcp0OizIHX4OYf1CSWsQbJZFm
|
||||||
|
SdrUwKyijYR9nHKmjbFa+PWFh/HD630kkkLEFt+Ti+CsdNe0+Hmfc7cCgYEAzmVS
|
||||||
|
JX9DZVZMvEUPanPrHI1vAkFTd9YSGPx088yadomF8cL6QbYXUFq+ZMq3st70S+qr
|
||||||
|
XxBXjjmDTuE8tLepZemIIM9UC6AQ+2IE/RiThLyKrhk9b/7myqWSz9cY8/SqMOsW
|
||||||
|
015U4Jc+KRS1/Tse8Y7tyzHFlthACoKX5HrxNxMCgYBuOQ1B1nu9ivKVQpGjFtpM
|
||||||
|
G4WTinGK9Q7XiwddgOlleyCSy21KVRssATZpkXWnUu+5Lqa6Y/Pg2sWrpWNztarp
|
||||||
|
tPHqTMAAE+dyJSISsoGfTXa9/iNXo7py3kqYUovh537I67lPRoFoc3+Wg915wpIM
|
||||||
|
RnnI6aPuzjQBLdn0boLiVQKBgQC/cv6y54ylmFqPnOPC1Am3r33UMrJxC3I4GR2G
|
||||||
|
9DgnUkOb0Ud/4p9XmwTWy6+ATQ2AygnyoV8F/1VMuuMrot2QOgJapNaJ/g0ikXad
|
||||||
|
KsnTq2xcN+9kTqbYPKOlBRoRWNbxj2/Z2ruSpNg1FRAG+GsomHL9M4rb9HXbCe5J
|
||||||
|
Mr1DXwKBgQDmsYhXErxHiQ0jwDgqFmcKRjm/UvEGzuJ1wMZzCBU1GNAOid25QHvI
|
||||||
|
VIsJjYT6idRNHNxFr7AoW5bpTRMsfh8nLD4VfK9k2HbiRbZmDhC03zxXpgbzRWrp
|
||||||
|
bWTuoTIidPr5pt6XFlPU9NYPfgpGJvcCSbE15UQBd4DLts+UcZZ3Zw==
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
26
dbm/db.go
Normal file
26
dbm/db.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) SaveData(c *gin.Context) {
|
||||||
|
s := time.Now()
|
||||||
|
if err := d.SaveDb(); err != nil {
|
||||||
|
r := json_dataModels.NewResponse()
|
||||||
|
r.SendError(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
r := json_dataModels.NewResponse()
|
||||||
|
r.SendMessage(fmt.Sprintf("DBM %d datapoints saved in: %v", d.GetNumbersOfDatapoints(), time.Since(s)))
|
||||||
|
d.Log.Info("db.SaveData", fmt.Sprintf("DBM %d datapoints saved in: %v", d.GetNumbersOfDatapoints(), time.Since(s)))
|
||||||
|
c.JSON(http.StatusOK, r)
|
||||||
|
}
|
||||||
161
dbm/dbmHandler.go
Normal file
161
dbm/dbmHandler.go
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/tecamino/tecamino-dbm/args"
|
||||||
|
"github.com/tecamino/tecamino-dbm/models"
|
||||||
|
serverModels "github.com/tecamino/tecamino-dbm/server/models"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
"github.com/tecamino/tecamino-logger/logging"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBMHandler struct {
|
||||||
|
filePath string
|
||||||
|
DB models.Datapoint
|
||||||
|
Conns *serverModels.Connections
|
||||||
|
sync.RWMutex
|
||||||
|
Log *logging.Logger
|
||||||
|
arg *args.Args
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialze new Database Manager
|
||||||
|
// it will call cli arguments
|
||||||
|
func NewDbmHandler(a *args.Args) (*DBMHandler, error) {
|
||||||
|
|
||||||
|
logger, err := logging.NewLogger("dbmServer.log", &logging.Config{
|
||||||
|
MaxSize: 1,
|
||||||
|
MaxBackup: 3,
|
||||||
|
MaxAge: 28,
|
||||||
|
Debug: a.Debug,
|
||||||
|
TerminalOut: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
logger.Info("main", "start dma handler")
|
||||||
|
|
||||||
|
// Initialize dtabase manager handler
|
||||||
|
dmaHandler := DBMHandler{
|
||||||
|
arg: a,
|
||||||
|
filePath: fmt.Sprintf("%s/%s.dbm", a.RootDir, a.DBMFile),
|
||||||
|
Log: logger,
|
||||||
|
Conns: serverModels.NewConnections(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// initialize system datapoint and periodically update it
|
||||||
|
if err := dmaHandler.AddSystemDps(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if dtabase file exists to load data
|
||||||
|
s := time.Now()
|
||||||
|
if _, err := os.Stat(dmaHandler.filePath); err == nil {
|
||||||
|
|
||||||
|
f, err := os.Open(dmaHandler.filePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
// read in dtaabase file content
|
||||||
|
scanner := bufio.NewScanner(f)
|
||||||
|
|
||||||
|
for scanner.Scan() {
|
||||||
|
dp := models.Datapoint{}
|
||||||
|
if err = json.Unmarshal(scanner.Bytes(), &dp); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
dmaHandler.ImportDatapoints(dp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dmaHandler.Log.Info("dmbHandler.NewDmbHandler", fmt.Sprintf("%d datapoint imported in %v", dmaHandler.GetNumbersOfDatapoints(), time.Since(s)))
|
||||||
|
return &dmaHandler, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) SaveDb() (err error) {
|
||||||
|
f, err := os.OpenFile(d.filePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0666)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
for _, dp := range d.DB.GetAllDatapoints(0) {
|
||||||
|
b, er := json.Marshal(dp)
|
||||||
|
if er != nil {
|
||||||
|
return er
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = f.Write(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_, err = f.Write([]byte("\n"))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) CreateDatapoints(sets ...json_dataModels.Set) ([]json_dataModels.Set, error) {
|
||||||
|
if len(sets) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
dps, err := d.DB.CreateDatapoints(d.Conns, sets...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var ndp uint64
|
||||||
|
for _, dp := range dps {
|
||||||
|
if !dp.Updated {
|
||||||
|
ndp++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dp := d.QueryDatapoints(1, "System:Datapoints")
|
||||||
|
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+ndp)
|
||||||
|
return dps, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) ImportDatapoints(dps ...models.Datapoint) error {
|
||||||
|
for _, dp := range dps {
|
||||||
|
err := d.DB.ImportDatapoint(d.Conns, dp, dp.Path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dp := d.QueryDatapoints(1, "System:Datapoints")
|
||||||
|
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+1)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) UpdateDatapointValue(path string, value any) error {
|
||||||
|
return d.DB.UpdateDatapointValue(d.Conns, value, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) RemoveDatapoint(sets ...json_dataModels.Set) ([]json_dataModels.Set, error) {
|
||||||
|
var lsRemoved []json_dataModels.Set
|
||||||
|
for _, set := range sets {
|
||||||
|
removed, err := d.DB.RemoveDatapoint(d.Conns, set)
|
||||||
|
if err != nil {
|
||||||
|
return lsRemoved, err
|
||||||
|
}
|
||||||
|
lsRemoved = append(lsRemoved, removed)
|
||||||
|
dp := d.QueryDatapoints(1, "System:Datapoints")
|
||||||
|
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return lsRemoved, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) QueryDatapoints(depth uint, key string) []*models.Datapoint {
|
||||||
|
return d.DB.QueryDatapoints(depth, key)
|
||||||
|
}
|
||||||
82
dbm/json_data.go
Normal file
82
dbm/json_data.go
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
json_data "github.com/tecamino/tecamino-json_data"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) Json_Data(c *gin.Context) {
|
||||||
|
var err error
|
||||||
|
payload, err := json_data.ParseRequest(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SendError(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
respond := json_dataModels.NewResponse()
|
||||||
|
|
||||||
|
if payload.Get != nil {
|
||||||
|
var depth uint = 1
|
||||||
|
for _, get := range payload.Get {
|
||||||
|
if get.Query != nil {
|
||||||
|
depth = get.Query.Depth
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, res := range d.QueryDatapoints(depth, get.Path) {
|
||||||
|
respond.AddGet(json_dataModels.Get{
|
||||||
|
Uuid: res.Uuid,
|
||||||
|
Path: res.Path,
|
||||||
|
Type: res.Type,
|
||||||
|
Value: res.Value,
|
||||||
|
Rights: res.ReadWrite,
|
||||||
|
Drivers: &res.Drivers,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if payload.Set != nil {
|
||||||
|
respond.Set, err = d.CreateDatapoints(payload.Set...)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SendError(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(200, respond)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) Delete(c *gin.Context) {
|
||||||
|
var err error
|
||||||
|
payload, err := json_data.ParseRequest(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SendError(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
response := json_data.NewResponse()
|
||||||
|
|
||||||
|
if payload.Set != nil {
|
||||||
|
|
||||||
|
response.Set, err = d.RemoveDatapoint(payload.Set...)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SendError(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(200, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
19
dbm/set.go
Normal file
19
dbm/set.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) Set(sets []json_dataModels.Set) {
|
||||||
|
if sets == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.RLock()
|
||||||
|
defer d.RUnlock()
|
||||||
|
|
||||||
|
for _, set := range sets {
|
||||||
|
for _, dp := range d.DB.QueryDatapoints(1, set.Path) {
|
||||||
|
dp.UpdateValue(d.Conns, set.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
75
dbm/subscribe.go
Normal file
75
dbm/subscribe.go
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/coder/websocket/wsjson"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) Subscribe(subs []json_dataModels.Subscribe, id string) {
|
||||||
|
if subs == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.RLock()
|
||||||
|
defer d.RUnlock()
|
||||||
|
|
||||||
|
client, ok := d.Conns.Clients[id]
|
||||||
|
if !ok {
|
||||||
|
d.Log.Error("subscribe.Subscribe", "client not found for id "+id)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
response := json_dataModels.NewResponse()
|
||||||
|
|
||||||
|
for _, sub := range subs {
|
||||||
|
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
|
||||||
|
if sub.Driver != "" {
|
||||||
|
if dp.Drivers == nil || dp.Drivers[sub.Driver] == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dp.AddSubscribtion(id, sub)
|
||||||
|
response.AddSubscription(json_dataModels.Subscribe{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Value: dp.Value,
|
||||||
|
Driver: sub.Driver,
|
||||||
|
Drivers: &dp.Drivers,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := wsjson.Write(client.Ctx, client.Conn, response); err != nil {
|
||||||
|
d.Log.Error("subscribe.Subscribe", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) Unsubscribe(subs []json_dataModels.Subscribe, id string) {
|
||||||
|
if subs == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.RLock()
|
||||||
|
defer d.RUnlock()
|
||||||
|
|
||||||
|
client, ok := d.Conns.Clients[id]
|
||||||
|
if !ok {
|
||||||
|
d.Log.Error("subscribe.Subscribe", "client not found for id "+id)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
response := json_dataModels.NewResponse()
|
||||||
|
|
||||||
|
for _, sub := range subs {
|
||||||
|
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
|
||||||
|
if _, ok := dp.Subscriptions[id]; !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dp.RemoveSubscribtion(id)
|
||||||
|
response.AddUnsubscription(json_dataModels.Subscribe{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := wsjson.Write(client.Ctx, client.Conn, response); err != nil {
|
||||||
|
d.Log.Error("subscribe.Subscribe", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
97
dbm/system.go
Normal file
97
dbm/system.go
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/tecamino/tecamino-dbm/utils"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) AddSystemDps() (err error) {
|
||||||
|
path := "System:Datapoints"
|
||||||
|
|
||||||
|
typ := json_dataModels.LOU
|
||||||
|
rights := json_dataModels.Read
|
||||||
|
_, err = d.DB.CreateDatapoints(d.Conns, json_dataModels.Set{Path: path, Value: 0, Type: typ, Rights: rights})
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("dmb.Handler.AddSystemDps", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dp := d.QueryDatapoints(1, path)
|
||||||
|
d.UpdateDatapointValue(path, dp[0].GetValueUint64()+1)
|
||||||
|
|
||||||
|
if err = d.GoSystemTime(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = d.GoSystemMemory(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) GetNumbersOfDatapoints() uint64 {
|
||||||
|
return utils.Uint64From(d.DB.Datapoints["System"].Datapoints["Datapoints"].Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) GoSystemTime() error {
|
||||||
|
path := "System:Time"
|
||||||
|
var tOld int64
|
||||||
|
|
||||||
|
typ := json_dataModels.STR
|
||||||
|
rights := json_dataModels.Read
|
||||||
|
_, err := d.DB.CreateDatapoints(d.Conns, json_dataModels.Set{Path: path, Type: typ, Rights: rights})
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("system.GoSystemTime", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dp := d.QueryDatapoints(1, "System:Datapoints")
|
||||||
|
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+1)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
t := time.Now().UnixMilli()
|
||||||
|
if tOld != t {
|
||||||
|
if er := d.DB.UpdateDatapointValue(d.Conns, t, path); er != nil {
|
||||||
|
d.Log.Error("dmb.Handler.AddSystemDps.UpdateDatapointValue", er.Error())
|
||||||
|
}
|
||||||
|
tOld = t
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) GoSystemMemory() error {
|
||||||
|
path := "System:UsedMemory"
|
||||||
|
var m runtime.MemStats
|
||||||
|
var mOld uint64
|
||||||
|
|
||||||
|
typ := json_dataModels.STR
|
||||||
|
rights := json_dataModels.Read
|
||||||
|
_, err := d.DB.CreateDatapoints(d.Conns, json_dataModels.Set{Path: path, Type: typ, Rights: rights})
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("system.GoSystemMemory", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dp := d.QueryDatapoints(1, "System:Datapoints")
|
||||||
|
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+1)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
runtime.ReadMemStats(&m)
|
||||||
|
if m.Sys != mOld {
|
||||||
|
mem := fmt.Sprintf("%.2f MB", float64(m.Sys)/1024/1024)
|
||||||
|
if er := d.DB.UpdateDatapointValue(d.Conns, mem, path); er != nil {
|
||||||
|
d.Log.Error("dmb.Handler.AddSystemDps.UpdateDatapointValue", er.Error())
|
||||||
|
}
|
||||||
|
mOld = m.Sys
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
78
dbm/webSocket.go
Normal file
78
dbm/webSocket.go
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/coder/websocket"
|
||||||
|
"github.com/coder/websocket/wsjson"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/tecamino/tecamino-dbm/auth"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
OnCreate = "onCreate"
|
||||||
|
OnChange = "onChange"
|
||||||
|
OnDelete = "onDelete"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) WebSocket(c *gin.Context) {
|
||||||
|
id, err := auth.GetIDFromQuery(c)
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("dbmHandler.webSocket.Websocket", "error GetIDFromQuery: "+err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.Log.Debug("dbmHandler.webSocket.Websocket", "authorization id token: "+id)
|
||||||
|
|
||||||
|
err = d.Conns.ConnectRecievingWsConnection(id, c)
|
||||||
|
defer d.Conns.RemoveClient(id)
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("dbmHandler.webSocket.Websocket", "error connecting recieving websocket conection: "+err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer d.Conns.DisconnectWsConnection(id, websocket.StatusInternalError, "Internal error")
|
||||||
|
|
||||||
|
//Read loop
|
||||||
|
for {
|
||||||
|
request, err := d.readJsonData(id)
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets
|
||||||
|
go d.Set(request.Set)
|
||||||
|
|
||||||
|
// Subscribe
|
||||||
|
go d.Subscribe(request.Subscribe, id)
|
||||||
|
|
||||||
|
// Unsubscribe
|
||||||
|
go d.Unsubscribe(request.Unsubscribe, id)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) readJsonData(id string) (request json_dataModels.Request, err error) {
|
||||||
|
|
||||||
|
client, ok := d.Conns.Clients[id]
|
||||||
|
if !ok {
|
||||||
|
return request, errors.New("client id not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = wsjson.Read(client.Ctx, client.Conn, &request)
|
||||||
|
if err != nil {
|
||||||
|
code := websocket.CloseStatus(err)
|
||||||
|
|
||||||
|
switch code {
|
||||||
|
case websocket.StatusNormalClosure,
|
||||||
|
websocket.StatusGoingAway,
|
||||||
|
websocket.StatusNoStatusRcvd:
|
||||||
|
d.Log.Info("webSocket.readJsonData", fmt.Sprintf("WebSocket closed: %v (code: %v)\n", err, code))
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
d.Log.Error("webSocket.readJsonData", fmt.Sprintf("WebSocket read error: %v (code: %v)\n", err, code))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
545
dbmServer.log
Normal file
545
dbmServer.log
Normal file
@@ -0,0 +1,545 @@
|
|||||||
|
{"level":"info","timestamp":"2025-04-24T12:45:01.930","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:45:02.868","msg":"70906 datapoint imported in 930.8401ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:45:02.869","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:45:02.869","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:06.093","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:07.041","msg":"70906 datapoint imported in %!f(time.Duration=940757100).2f","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:07.042","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:07.042","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:42.138","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:43.171","msg":"70906 datapoint imported in %!f(time.Duration=1025908600)","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:43.172","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:47:43.172","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:48:45.213","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:48:46.191","msg":"70906 datapoint imported in 971443100.00","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:48:46.193","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:48:46.193","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:28.741","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:29.696","msg":"70906 datapoint imported in 947.9423ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:29.697","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:29.699","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:52.592","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:53.564","msg":"70906 datapoint imported in 965.8849ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:53.565","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T12:57:53.565","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:26:52.685","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:26:53.699","msg":"70904 datapoint imported in 1.0068394s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:26:53.701","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:26:53.701","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T14:29:02.257","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: json: cannot unmarshal string into Go struct field Subscribe.subscribe.depth of type int (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T14:29:19.514","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character ']' looking for beginning of value (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T14:29:28.650","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character '}' looking for beginning of object key string (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T14:30:04.426","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: json: cannot unmarshal string into Go struct field Subscribe.subscribe.depth of type int (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:04.647","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:06.213","msg":"70904 datapoint imported in 1.5589017s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:06.213","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:06.213","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:32.445","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:34.159","msg":"70904 datapoint imported in 1.7024539s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:34.159","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:33:34.159","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:34:45.855","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:34:50.869","msg":"70904 datapoint imported in 5.0089018s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:34:50.870","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:34:50.870","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:35:41.131","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:35:49.457","msg":"70904 datapoint imported in 8.3191437s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:35:49.458","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:35:49.458","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:38:49.103","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:38:56.951","msg":"70904 datapoint imported in 7.8416317s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:38:56.952","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:38:56.952","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:39:49.904","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:39:50.870","msg":"70904 datapoint imported in 959.4998ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:39:50.870","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:39:50.870","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:43:33.774","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:43:34.868","msg":"70904 datapoint imported in 1.0850744s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:43:34.869","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:43:34.869","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:48:36.342","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:48:37.416","msg":"70904 datapoint imported in 1.0652234s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:48:37.417","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:48:37.417","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:49:34.042","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:49:35.084","msg":"70904 datapoint imported in 1.0351849s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:49:35.085","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:49:35.085","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:50:17.667","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusGoingAway and reason = \"\" (code: StatusGoingAway)\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:52:45.697","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:52:46.702","msg":"70904 datapoint imported in 997.5948ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:52:46.703","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T14:52:46.703","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:08:44.184","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:08:45.189","msg":"70904 datapoint imported in 998.5883ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:08:45.190","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:08:45.190","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:30:17.557","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:30:18.637","msg":"70904 datapoint imported in 1.0739246s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:30:18.639","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:30:18.639","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:35:58.063","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:35:59.186","msg":"70907 datapoint imported in 1.1117907s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:35:59.187","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:35:59.187","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T16:36:04.516","msg":"error GetIDFromQuery: id missing","caller":"dbmHandler.webSocket.Websocket"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:36:29.461","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:37:25.546","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:37:26.683","msg":"70907 datapoint imported in 1.1293837s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:37:26.685","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:37:26.685","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T16:37:33.281","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character '}' looking for beginning of object key string (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T16:37:38.731","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character '}' looking for beginning of object key string (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:38:43.381","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:38:44.403","msg":"70907 datapoint imported in 1.0144352s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:38:44.405","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:38:44.405","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T16:39:02.357","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character 'A' after object key (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:40:52.392","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:40:53.418","msg":"70907 datapoint imported in 1.0194209s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:40:53.424","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:40:53.424","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:41:42.848","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:41:43.839","msg":"70907 datapoint imported in 985.2872ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:41:43.840","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:41:43.840","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:42:41.443","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:42:42.505","msg":"70907 datapoint imported in 1.0560975s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:42:42.505","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:42:42.505","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:47:25.135","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:47:26.111","msg":"70907 datapoint imported in 968.3434ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:47:26.112","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:47:26.112","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:48:13.506","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:48:14.465","msg":"70907 datapoint imported in 951.0514ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:48:14.466","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:48:14.466","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:49:36.877","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:49:37.849","msg":"70907 datapoint imported in 964.333ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:49:37.850","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:49:37.850","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:00.974","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:01.984","msg":"70907 datapoint imported in 1.0032639s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:01.985","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:01.985","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:50.119","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:51.108","msg":"70907 datapoint imported in 981.7711ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:51.110","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:50:51.110","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:01.560","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:02.564","msg":"70907 datapoint imported in 997.4066ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:02.565","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:02.565","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:34.461","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:35.449","msg":"70907 datapoint imported in 981.7288ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:35.452","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:52:35.452","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:55:07.627","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:55:08.567","msg":"70907 datapoint imported in 934.6237ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:55:08.568","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:55:08.568","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:56:30.243","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:56:31.228","msg":"70907 datapoint imported in 977.9019ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:56:31.229","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T16:56:31.229","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:07:51.586","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:07:52.531","msg":"70907 datapoint imported in 937.0328ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:07:52.532","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:07:52.532","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:09:24.427","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:09:25.452","msg":"70907 datapoint imported in 1.017777s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:09:25.453","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:09:25.453","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:19.652","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:20.695","msg":"70907 datapoint imported in 1.0316411s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:20.696","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:20.697","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:43.081","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:44.068","msg":"70907 datapoint imported in 980.6224ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:44.069","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:11:44.069","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:12:10.213","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:12:11.161","msg":"70907 datapoint imported in 941.7594ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:12:11.164","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:12:11.164","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:15:24.635","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:15:25.786","msg":"70907 datapoint imported in 1.1437172s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:15:25.787","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T17:15:25.787","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T17:27:35.012","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:57316: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T17:28:16.370","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:57322: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T17:30:19.143","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:57341: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T17:31:03.932","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: json: cannot unmarshal object into Go struct field Subscribe.subscribe.driver of type string (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T17:31:39.623","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: json: cannot unmarshal object into Go struct field Subscribe.subscribe.driver of type string (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T17:33:00.875","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:57377: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T18:43:46.137","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T18:43:46.146","msg":"driver information missing","caller":"dmb.Handler.AddSystemDps"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T18:44:54.586","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T18:44:56.165","msg":"70907 datapoint imported in 1.5670177s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T18:44:56.167","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T18:44:56.167","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T18:47:15.899","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:52319: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T19:04:24.211","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:52325: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:05:06.200","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:05:07.645","msg":"70907 datapoint imported in 1.4269942s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:05:07.646","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:05:07.646","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T21:05:47.723","msg":"error GetIDFromQuery: id missing","caller":"dbmHandler.webSocket.Websocket"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T21:06:41.071","msg":"error GetIDFromQuery: id missing","caller":"dbmHandler.webSocket.Websocket"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T21:07:03.574","msg":"error GetIDFromQuery: id missing","caller":"dbmHandler.webSocket.Websocket"}
|
||||||
|
{"level":"error","timestamp":"2025-04-24T21:07:20.319","msg":"error GetIDFromQuery: id missing","caller":"dbmHandler.webSocket.Websocket"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:12:41.436","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:12:42.814","msg":"70907 datapoint imported in 1.3713767s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:12:42.816","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:12:42.816","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:14:12.004","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:14:13.145","msg":"70907 datapoint imported in 1.1323784s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:14:13.147","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:14:13.147","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:19:10.003","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:19:11.118","msg":"70907 datapoint imported in 1.1069385s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:19:11.120","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T21:19:11.120","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:16:43.417","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:16:44.736","msg":"70907 datapoint imported in 1.3123902s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:16:44.737","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:16:44.737","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:20:52.266","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:20:53.515","msg":"70907 datapoint imported in 1.2422894s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:20:53.516","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:20:53.516","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:23:40.476","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:23:44.389","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:24:00.215","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:24:02.022","msg":"70907 datapoint imported in 1.7927614s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:24:02.024","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:24:02.024","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:25:40.901","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:25:42.278","msg":"70907 datapoint imported in 1.3679863s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:25:42.280","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:25:42.280","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:26:33.502","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:26:34.850","msg":"70907 datapoint imported in 1.3400612s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:26:34.852","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-24T22:26:34.852","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:10:44.651","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:10:45.573","msg":"70907 datapoint imported in 914.6413ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:10:45.574","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:10:45.574","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:11:44.453","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:11:45.361","msg":"70907 datapoint imported in 899.9752ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:11:45.362","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:11:45.362","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:12:16.822","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:12:17.727","msg":"70907 datapoint imported in 899.1678ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:12:17.728","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:12:17.728","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:17:24.330","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:17:25.250","msg":"70907 datapoint imported in 911.9596ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:17:25.251","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T07:17:25.251","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:25:32.926","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:25:33.921","msg":"70907 datapoint imported in 986.1125ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:25:33.922","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:25:33.922","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:27:16.655","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:27:17.684","msg":"70907 datapoint imported in 1.0210028s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:27:17.686","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:27:17.686","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:30:55.958","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:30:56.908","msg":"70907 datapoint imported in 943.4574ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:30:56.909","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T08:30:56.909","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T08:33:01.191","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:56377: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T08:33:54.415","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character 't' after object key (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:05:51.134","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:05:52.070","msg":"70906 datapoint imported in 928.9406ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:05:52.070","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:05:52.070","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:07:02.361","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:07:03.273","msg":"70906 datapoint imported in 905.3446ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:07:03.274","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:07:03.274","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:08:58.495","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:08:59.563","msg":"70906 datapoint imported in 1.0605929s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:08:59.565","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:08:59.565","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:11:13.994","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:11:14.990","msg":"70906 datapoint imported in 988.5955ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:11:15.009","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:11:15.009","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:12:10.501","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:12:11.497","msg":"70906 datapoint imported in 988.7645ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:12:11.497","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:12:11.497","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:16:28.284","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:16:29.280","msg":"70906 datapoint imported in 989.4656ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:16:29.282","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:16:29.282","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:18:38.809","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:18:39.792","msg":"70906 datapoint imported in 975.1616ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:18:39.793","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:18:39.793","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:19:14.614","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:19:15.589","msg":"70906 datapoint imported in 967.5841ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:19:15.590","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:19:15.590","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:20:13.787","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:20:14.802","msg":"70906 datapoint imported in 1.0079694s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:20:14.803","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:20:14.803","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:22:55.612","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:22:56.642","msg":"70906 datapoint imported in 1.0237716s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:22:56.644","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T09:22:56.644","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T11:56:04.487","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T11:56:54.839","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T11:57:19.923","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T11:58:34.896","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T11:59:18.942","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:01:11.727","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:01:46.005","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:01:46.807","msg":"70906 datapoint imported in 794.9182ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:01:46.808","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:01:46.808","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T12:03:27.661","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:58256: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T12:05:06.726","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T12:05:53.664","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:58285: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:07:09.410","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:07:10.211","msg":"70906 datapoint imported in 792.3726ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:07:10.213","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:07:10.213","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:08:37.247","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:08:38.103","msg":"70906 datapoint imported in 846.815ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:08:38.105","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:08:38.105","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:09:19.425","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:09:20.262","msg":"70906 datapoint imported in 828.3318ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:09:20.263","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:09:20.263","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:10:07.809","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:10:08.602","msg":"70906 datapoint imported in 784.836ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:10:08.605","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:10:08.606","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:12:41.795","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:12:42.550","msg":"70906 datapoint imported in 748.8353ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:12:42.551","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T12:12:42.551","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:12:03.575","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:12:04.428","msg":"70906 datapoint imported in 845.4047ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:12:04.430","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:12:04.430","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:13:18.695","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:13:19.479","msg":"70906 datapoint imported in 775.076ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:13:19.481","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:13:19.481","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:14:27.381","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:14:28.148","msg":"70906 datapoint imported in 761.1693ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:14:28.149","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:14:28.149","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:15:24.104","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:15:24.891","msg":"70906 datapoint imported in 780.7757ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:15:24.892","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:15:24.892","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:20:24.788","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:21:01.653","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:22:21.659","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:23:21.812","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:23:22.611","msg":"70906 datapoint imported in 792.0699ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:23:22.612","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T13:23:22.612","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:09:23.012","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:09:23.821","msg":"70906 datapoint imported in 801.9546ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:09:23.822","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:09:23.822","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:16:40.059","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60453: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:17:30.460","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60466: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:18:11.705","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60471: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:18:37.346","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60474: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:19:19.728","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60482: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:20:41.498","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60490: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:21:31.964","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:21:32.684","msg":"70906 datapoint imported in 713.2521ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:21:32.686","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:21:32.686","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:21:50.922","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60500: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:40:12.968","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60638: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:41:10.660","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60643: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:42:37.316","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60649: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:43:12.558","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60668: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:45:58.700","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:48:02.254","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:48:48.574","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60707: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:48:51.929","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:48:52.816","msg":"70906 datapoint imported in 880.8198ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:48:52.816","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:48:52.816","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:49:45.093","msg":"WebSocket read error: failed to read JSON message: failed to get reader: received close frame: status = StatusInvalidFramePayloadData and reason = \"failed to unmarshal JSON\" (code: StatusInvalidFramePayloadData)\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:50:15.446","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:50:16.195","msg":"70906 datapoint imported in 742.7985ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:50:16.195","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:50:16.195","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:50:45.652","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60741: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:53:05.586","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:53:06.651","msg":"70906 datapoint imported in 1.0570504s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:53:06.655","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T17:53:06.655","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T17:54:34.780","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60795: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:10:44.312","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:10:45.332","msg":"70906 datapoint imported in 1.0134914s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:10:45.335","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:10:45.335","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:13:20.722","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:13:22.194","msg":"70906 datapoint imported in 1.4611265s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:13:22.196","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:13:22.196","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:13:57.021","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60114: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:14:36.932","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60121: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:18:10.065","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60145: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:18:38.801","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60150: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:20:42.312","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60172: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:21:03.724","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:21:04.929","msg":"70906 datapoint imported in 1.1963319s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:21:04.930","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:21:04.930","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:21:15.257","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60178: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:22:19.764","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:22:20.997","msg":"70906 datapoint imported in 1.2254849s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:22:20.999","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:22:20.999","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:22:35.605","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60189: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:25:03.634","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:25:04.696","msg":"70906 datapoint imported in 1.0560832s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:25:04.699","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:25:04.699","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:26:42.314","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:26:43.284","msg":"70906 datapoint imported in 961.4825ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:26:43.285","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:26:43.285","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:29:02.744","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:29:03.951","msg":"70906 datapoint imported in 1.198078s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:29:03.953","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:29:03.953","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:30:19.122","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:30:20.174","msg":"70907 datapoint imported in 1.0439618s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:30:20.175","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:30:20.175","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:30:33.182","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60254: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:31:52.116","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60262: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:33:49.944","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60273: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:35:43.555","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60285: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:39:48.869","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:39:49.961","msg":"70907 datapoint imported in 1.0772318s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:39:49.964","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:39:49.965","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:41:04.179","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60332: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:41:51.029","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60338: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:43:21.868","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:43:23.055","msg":"70907 datapoint imported in 1.1785275s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:43:23.055","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-25T18:43:23.055","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:43:35.371","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60375: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:45:03.461","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60383: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:45:11.765","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60387: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-25T18:46:50.227","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:60392: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:07:01.993","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:07:02.988","msg":"70907 datapoint imported in 987.5445ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:07:02.989","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:07:02.989","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:08:36.247","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T07:08:42.204","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:52468: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:09:43.158","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:09:44.206","msg":"70907 datapoint imported in 1.0379535s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:09:44.208","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:09:44.208","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T07:12:48.948","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T07:16:13.566","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character ';' after object key (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T07:17:20.409","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:52546: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:23:23.492","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:23:23.501","msg":"3 datapoint imported in 0s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:23:23.505","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:23:23.505","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:28:11.405","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:28:11.411","msg":"3 datapoint imported in 613.1µs","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:28:11.412","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:28:11.412","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:45:48.847","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:45:48.857","msg":"3 datapoint imported in 0s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:45:48.859","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:45:48.859","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T07:46:16.024","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:52947: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:49:22.293","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:49:22.300","msg":"3 datapoint imported in 504.8µs","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:49:22.301","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:49:22.301","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:52:36.070","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:52:36.079","msg":"3 datapoint imported in 805.4µs","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:52:36.080","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:52:36.080","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:55:25.033","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:55:25.039","msg":"3 datapoint imported in 0s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:55:25.040","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:55:25.040","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:00.576","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:00.585","msg":"3 datapoint imported in 0s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:00.586","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:00.586","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:20.143","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:20.155","msg":"3 datapoint imported in 0s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:20.157","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:56:20.157","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:59:53.072","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:59:54.150","msg":"70907 datapoint imported in 1.0687481s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:59:54.151","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T07:59:54.151","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T08:02:15.702","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:53172: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T08:03:05.908","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T08:03:52.274","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:53205: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T08:04:17.582","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:53211: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T08:07:12.339","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T08:07:13.304","msg":"70907 datapoint imported in 958.7766ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T08:07:13.304","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T08:07:13.304","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T08:07:26.521","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:53246: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:45:43.538","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:45:44.528","msg":"70907 datapoint imported in 982.6566ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:45:44.528","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:45:44.528","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T17:45:53.885","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:65143: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T17:46:21.883","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:65149: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:47:50.257","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:47:51.060","msg":"70907 datapoint imported in 796.7003ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:47:51.061","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:47:51.061","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T17:48:00.013","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:65170: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:48:52.882","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:48:53.730","msg":"70907 datapoint imported in 842.8278ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:48:53.731","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:48:53.731","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:49:28.036","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:49:28.825","msg":"70907 datapoint imported in 782.5554ms","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:49:28.826","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T17:49:28.826","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T17:54:40.497","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:65239: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T17:55:11.490","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:65259: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T17:59:15.995","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:65267: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:47:42.420","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:47:43.986","msg":"70907 datapoint imported in 1.5574372s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:47:43.990","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:47:43.990","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T20:51:02.307","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:56:52.360","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:56:53.533","msg":"70907 datapoint imported in 1.1662469s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:56:53.535","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T20:56:53.535","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T21:20:39.790","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T21:33:04.705","msg":"start dma handler","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T21:33:05.936","msg":"70907 datapoint imported in 1.2248659s","caller":"dmbHandler.NewDmbHandler"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T21:33:05.939","msg":"https listen on 8101","caller":"main"}
|
||||||
|
{"level":"info","timestamp":"2025-04-28T21:33:05.939","msg":"http listen on 8100","caller":"main"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T21:36:40.240","msg":"WebSocket read error: failed to read JSON message: failed to get reader: context deadline exceeded (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T21:40:06.328","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:63981: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T21:40:55.826","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:64037: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
|
{"level":"error","timestamp":"2025-04-28T21:45:48.901","msg":"WebSocket read error: failed to read JSON message: failed to get reader: failed to read frame header: read tcp 127.0.0.1:8100->127.0.0.1:64148: wsarecv: An existing connection was forcibly closed by the remote host. (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
||||||
16
drivers/artNet.go
Normal file
16
drivers/artNet.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package drivers
|
||||||
|
|
||||||
|
type ArtNetDriver struct {
|
||||||
|
Bus string
|
||||||
|
Addresses []uint
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewArtNetDriver(bus string) *ArtNetDriver {
|
||||||
|
return &ArtNetDriver{
|
||||||
|
Bus: bus,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ArtNetDriver) AddAddress(adr uint) {
|
||||||
|
a.Addresses = append(a.Addresses, adr)
|
||||||
|
}
|
||||||
7
drivers/drivers.go
Normal file
7
drivers/drivers.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package drivers
|
||||||
|
|
||||||
|
type Drivers []Driver
|
||||||
|
|
||||||
|
type Driver interface {
|
||||||
|
AddAddress()
|
||||||
|
}
|
||||||
43
go.mod
Normal file
43
go.mod
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
module github.com/tecamino/tecamino-dbm
|
||||||
|
|
||||||
|
go 1.24.0
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/coder/websocket v1.8.13
|
||||||
|
github.com/gin-gonic/gin v1.10.0
|
||||||
|
github.com/google/uuid v1.6.0
|
||||||
|
github.com/tecamino/tecamino-json_data v0.0.10
|
||||||
|
github.com/tecamino/tecamino-logger v0.2.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/bytedance/sonic v1.11.6 // indirect
|
||||||
|
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||||
|
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||||
|
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||||
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||||
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||||
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
|
go.uber.org/multierr v1.10.0 // indirect
|
||||||
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
|
golang.org/x/arch v0.8.0 // indirect
|
||||||
|
golang.org/x/crypto v0.23.0 // indirect
|
||||||
|
golang.org/x/net v0.25.0 // indirect
|
||||||
|
golang.org/x/sys v0.20.0 // indirect
|
||||||
|
golang.org/x/text v0.15.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.34.1 // indirect
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
)
|
||||||
105
go.sum
Normal file
105
go.sum
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||||
|
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||||
|
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||||
|
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||||
|
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||||
|
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||||
|
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||||
|
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||||
|
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
|
||||||
|
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||||
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
|
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||||
|
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||||
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
|
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||||
|
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||||
|
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||||
|
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||||
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||||
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||||
|
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||||
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/tecamino/tecamino-json_data v0.0.10 h1:I5xvJ8eRxX0QbMTuSHlAA16FQ8uE49OiCSsQ7Xjircc=
|
||||||
|
github.com/tecamino/tecamino-json_data v0.0.10/go.mod h1:LLlyD7Wwqplb2BP4PeO86EokEcTRidlW5MwgPd1T2JY=
|
||||||
|
github.com/tecamino/tecamino-logger v0.2.0 h1:NPH/Gg9qRhmVoW8b39i1eXu/LEftHc74nyISpcRG+XU=
|
||||||
|
github.com/tecamino/tecamino-logger v0.2.0/go.mod h1:0M1E9Uei/qw3e3WA1x3lBo1eP3H5oeYE7GjYrMahnj8=
|
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||||
|
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||||
|
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||||
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
|
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||||
|
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
|
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||||
|
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||||
|
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||||
|
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||||
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
|
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||||
|
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||||
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||||
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
||||||
|
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
|
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||||
49
main.go
Normal file
49
main.go
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/tecamino/tecamino-dbm/args"
|
||||||
|
"github.com/tecamino/tecamino-dbm/dbm"
|
||||||
|
"github.com/tecamino/tecamino-dbm/server"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
//cli arguments
|
||||||
|
a := args.Init()
|
||||||
|
|
||||||
|
dbmHandler, err := dbm.NewDbmHandler(a)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer dbmHandler.SaveDb()
|
||||||
|
|
||||||
|
//initialize new server
|
||||||
|
dbmHandler.Log.Debug("main", "initialize new server instance")
|
||||||
|
s := server.NewServer()
|
||||||
|
|
||||||
|
//set routes
|
||||||
|
dbmHandler.Log.Debug("main", "setting routes")
|
||||||
|
s.Routes.GET("/ws", dbmHandler.WebSocket)
|
||||||
|
s.Routes.GET("/saveData", dbmHandler.SaveData)
|
||||||
|
s.Routes.POST("/json_data", dbmHandler.Json_Data)
|
||||||
|
s.Routes.DELETE("/json_data", dbmHandler.Delete)
|
||||||
|
|
||||||
|
s.Routes.GET("/", func(c *gin.Context) {
|
||||||
|
c.String(200, "DBM WebSocket Server is running!")
|
||||||
|
})
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
dbmHandler.Log.Info("main", fmt.Sprintf("http listen on %d", a.Port.Http))
|
||||||
|
// start http server
|
||||||
|
if err := s.ServeHttp(a.Port.Http); err != nil {
|
||||||
|
dbmHandler.Log.Error("main", "error http server "+err.Error())
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
dbmHandler.Log.Info("main", fmt.Sprintf("https listen on %d", a.Port.Https))
|
||||||
|
panic(s.ServeHttps(a.Port.Https, a.Cert))
|
||||||
|
|
||||||
|
}
|
||||||
392
models/datapoints.go
Normal file
392
models/datapoints.go
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/coder/websocket/wsjson"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
serverModels "github.com/tecamino/tecamino-dbm/server/models"
|
||||||
|
"github.com/tecamino/tecamino-dbm/utils"
|
||||||
|
json_data "github.com/tecamino/tecamino-json_data"
|
||||||
|
json_dataModels "github.com/tecamino/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
OnCreate = "onCreate"
|
||||||
|
OnChange = "onChange"
|
||||||
|
OnDelete = "onDelete"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Datapoint struct {
|
||||||
|
Datapoints map[string]*Datapoint `json:"-"`
|
||||||
|
Uuid uuid.UUID `json:"uuid"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
Value any `json:"value,omitempty"`
|
||||||
|
CreateDateTime int64 `json:"createDateTime,omitempty"`
|
||||||
|
UpdateDateTime int64 `json:"updateDateTime,omitempty"`
|
||||||
|
Type json_dataModels.Type `json:"type"`
|
||||||
|
ReadWrite json_dataModels.Rights `json:"readWrite"`
|
||||||
|
Drivers json_dataModels.Drivers `json:"drivers,omitempty"`
|
||||||
|
Subscriptions Subscriptions `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) Set(path string, set json_dataModels.Set) (bool, error) {
|
||||||
|
var changed bool
|
||||||
|
if path != "" {
|
||||||
|
changed = true
|
||||||
|
d.Path = path
|
||||||
|
}
|
||||||
|
|
||||||
|
if set.Type != "" {
|
||||||
|
changed = true
|
||||||
|
d.Type = set.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Type != "" {
|
||||||
|
if d.Value == nil && set.Value == nil {
|
||||||
|
changed = true
|
||||||
|
d.Value = d.Type.DefaultValue()
|
||||||
|
} else if d.Value != d.Type.ConvertValue(set.Value) {
|
||||||
|
changed = true
|
||||||
|
d.Value = d.Type.ConvertValue(set.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if set.Rights != "" {
|
||||||
|
changed = true
|
||||||
|
d.ReadWrite = set.Rights.GetRights()
|
||||||
|
}
|
||||||
|
|
||||||
|
if changed {
|
||||||
|
d.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
}
|
||||||
|
|
||||||
|
if set.Driver == nil {
|
||||||
|
return changed, nil
|
||||||
|
}
|
||||||
|
if set.Driver.Type == "" {
|
||||||
|
return changed, errors.New("driver type missing")
|
||||||
|
}
|
||||||
|
if set.Driver.Bus == "" {
|
||||||
|
return changed, errors.New("driver bus name missing")
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Drivers == nil {
|
||||||
|
d.Drivers = json_dataModels.NewDrivers()
|
||||||
|
}
|
||||||
|
d.Drivers.AddDriver(set.Driver.Type, set.Driver.Bus, set.Driver.Address)
|
||||||
|
d.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
|
||||||
|
return changed, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) GetValueUint64() uint64 {
|
||||||
|
return utils.Uint64From(d.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) CreateDatapoints(conns *serverModels.Connections, sets ...json_dataModels.Set) (created []json_dataModels.Set, err error) {
|
||||||
|
if len(sets) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, dp := range sets {
|
||||||
|
parts := strings.Split(dp.Path, ":")
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i, part := range parts {
|
||||||
|
if current.Datapoints == nil {
|
||||||
|
current.Datapoints = make(map[string]*Datapoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == len(parts)-1 {
|
||||||
|
// Leaf node: create or update datapoint
|
||||||
|
if existing, ok := current.Datapoints[part]; ok {
|
||||||
|
publish, err := existing.Set("", dp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: existing.Uuid,
|
||||||
|
Path: existing.Path,
|
||||||
|
Type: existing.Type,
|
||||||
|
Value: existing.Value,
|
||||||
|
Rights: existing.ReadWrite,
|
||||||
|
Drivers: &existing.Drivers,
|
||||||
|
Updated: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
if publish {
|
||||||
|
existing.Publish(conns, OnChange)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ndp := Datapoint{
|
||||||
|
Uuid: uuid.New(),
|
||||||
|
CreateDateTime: time.Now().UnixMilli(),
|
||||||
|
Subscriptions: InitSubscribtion(),
|
||||||
|
}
|
||||||
|
// Create new
|
||||||
|
current.Datapoints[part] = &ndp
|
||||||
|
publish, err := ndp.Set(strings.Join(parts, ":"), dp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: ndp.Uuid,
|
||||||
|
Path: ndp.Path,
|
||||||
|
Type: ndp.Type,
|
||||||
|
Value: ndp.Value,
|
||||||
|
Rights: ndp.ReadWrite,
|
||||||
|
Driver: dp.Driver,
|
||||||
|
})
|
||||||
|
if publish {
|
||||||
|
current.Publish(conns, OnChange)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traverse or create intermediate datapoints
|
||||||
|
if next, ok := current.Datapoints[part]; ok {
|
||||||
|
current = next
|
||||||
|
} else {
|
||||||
|
newDp := &Datapoint{
|
||||||
|
Uuid: uuid.New(),
|
||||||
|
Path: strings.Join(parts[:i+1], ":"),
|
||||||
|
Type: json_dataModels.NONE,
|
||||||
|
CreateDateTime: time.Now().UnixMilli(),
|
||||||
|
UpdateDateTime: time.Now().UnixMilli(),
|
||||||
|
Subscriptions: InitSubscribtion(),
|
||||||
|
}
|
||||||
|
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: newDp.Uuid,
|
||||||
|
Path: newDp.Path,
|
||||||
|
Type: newDp.Type,
|
||||||
|
Value: newDp.Value,
|
||||||
|
Rights: newDp.ReadWrite,
|
||||||
|
})
|
||||||
|
|
||||||
|
if dp.Rights != "" {
|
||||||
|
newDp.ReadWrite = dp.Rights.GetRights()
|
||||||
|
}
|
||||||
|
|
||||||
|
current.Datapoints[part] = newDp
|
||||||
|
current = newDp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) ImportDatapoint(conns *serverModels.Connections, dp Datapoint, path string) error {
|
||||||
|
parts := strings.Split(dp.Path, ":")
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i, part := range parts {
|
||||||
|
if current.Datapoints == nil {
|
||||||
|
current.Datapoints = make(map[string]*Datapoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == len(parts)-1 {
|
||||||
|
// Leaf node: import the datapoint
|
||||||
|
if existing, ok := current.Datapoints[part]; ok {
|
||||||
|
existing.Type = dp.Type
|
||||||
|
existing.Value = current.Type.ConvertValue(dp.Value)
|
||||||
|
existing.ReadWrite = dp.ReadWrite.GetRights()
|
||||||
|
existing.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Publish(conns, OnChange)
|
||||||
|
} else {
|
||||||
|
dp.Path = strings.Join(parts, ":")
|
||||||
|
dp.ReadWrite = dp.ReadWrite.GetRights()
|
||||||
|
dp.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Subscriptions = InitSubscribtion()
|
||||||
|
current.Datapoints[part] = &dp
|
||||||
|
dp.Publish(conns, OnChange)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traverse or create intermediate nodes
|
||||||
|
if next, ok := current.Datapoints[part]; ok {
|
||||||
|
current = next
|
||||||
|
} else {
|
||||||
|
newDp := &Datapoint{
|
||||||
|
Path: strings.Join(parts[:i+1], ":"),
|
||||||
|
Type: json_dataModels.NONE,
|
||||||
|
ReadWrite: dp.ReadWrite.GetRights(),
|
||||||
|
UpdateDateTime: time.Now().UnixMilli(),
|
||||||
|
}
|
||||||
|
newDp.ReadWrite = newDp.ReadWrite.GetRights()
|
||||||
|
current.Datapoints[part] = newDp
|
||||||
|
current = newDp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) UpdateDatapointValue(conns *serverModels.Connections, value any, path string) error {
|
||||||
|
|
||||||
|
paths := strings.Split(path, ":")
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i, part := range paths {
|
||||||
|
dp, ok := current.Datapoints[part]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("datapoint path not found: %s (at %s)", path, part)
|
||||||
|
}
|
||||||
|
if i == len(paths)-1 {
|
||||||
|
dp.Value = dp.Type.ConvertValue(value)
|
||||||
|
dp.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Publish(conns, OnChange)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
current = dp
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) UpdateValue(conns *serverModels.Connections, value any) error {
|
||||||
|
d.Value = d.Type.ConvertValue(value)
|
||||||
|
d.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
d.Publish(conns, OnChange)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) RemoveDatapoint(conns *serverModels.Connections, set json_dataModels.Set) (json_dataModels.Set, error) {
|
||||||
|
parts := strings.Split(set.Path, ":")
|
||||||
|
|
||||||
|
if len(parts) < 1 {
|
||||||
|
return json_dataModels.Set{}, fmt.Errorf("invalid path: '%s'", set.Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i := range len(parts) - 1 {
|
||||||
|
next, ok := current.Datapoints[parts[i]]
|
||||||
|
if !ok {
|
||||||
|
return json_dataModels.Set{}, fmt.Errorf("path not found: '%s'", strings.Join(parts[:i+1], ":"))
|
||||||
|
}
|
||||||
|
current = next
|
||||||
|
}
|
||||||
|
|
||||||
|
toDelete := parts[len(parts)-1]
|
||||||
|
if dp, ok := current.Datapoints[toDelete]; ok {
|
||||||
|
dp.Publish(conns, OnDelete)
|
||||||
|
delete(current.Datapoints, toDelete)
|
||||||
|
return json_dataModels.Set{
|
||||||
|
Uuid: set.Uuid,
|
||||||
|
Path: set.Path,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
return json_dataModels.Set{}, fmt.Errorf("datapoint '%s' not found", set.Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) GetAllDatapoints(depth uint) (dps []*Datapoint) {
|
||||||
|
|
||||||
|
var dfs func(dp *Datapoint, currentDepth uint)
|
||||||
|
dfs = func(dp *Datapoint, currentDepth uint) {
|
||||||
|
if depth == 1 {
|
||||||
|
return
|
||||||
|
} else if depth == 0 {
|
||||||
|
// Return all descendants
|
||||||
|
for _, child := range dp.Datapoints {
|
||||||
|
dps = append(dps, child)
|
||||||
|
dfs(child, currentDepth+1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if currentDepth == depth-1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, child := range dp.Datapoints {
|
||||||
|
dps = append(dps, child)
|
||||||
|
dfs(child, currentDepth+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dps = append(dps, d)
|
||||||
|
dfs(d, 0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) QueryDatapoints(depth uint, path string) (dps []*Datapoint) {
|
||||||
|
parts := strings.Split(path, ":")
|
||||||
|
|
||||||
|
var dfs func(current *Datapoint, index int)
|
||||||
|
dfs = func(current *Datapoint, index int) {
|
||||||
|
|
||||||
|
if index == len(parts) {
|
||||||
|
dps = append(dps, current.GetAllDatapoints(depth)...)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
pattern := "^" + parts[index] + "$"
|
||||||
|
re, err := regexp.Compile(pattern)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, dp := range current.Datapoints {
|
||||||
|
if re.MatchString(name) {
|
||||||
|
dfs(dp, index+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dfs(d, 0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) AddSubscribtion(id string, sub json_dataModels.Subscribe) {
|
||||||
|
if d.Subscriptions == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if s, ok := d.Subscriptions[id]; ok {
|
||||||
|
s.OnCreate = sub.OnCreate
|
||||||
|
s.OnChange = sub.OnChange
|
||||||
|
s.OnDelete = sub.OnDelete
|
||||||
|
} else {
|
||||||
|
d.Subscriptions[id] = &Subscription{
|
||||||
|
OnCreate: sub.OnCreate,
|
||||||
|
OnChange: sub.OnChange,
|
||||||
|
OnDelete: sub.OnDelete,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) RemoveSubscribtion(id string) {
|
||||||
|
if _, ok := d.Subscriptions[id]; !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
delete(d.Subscriptions, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) Publish(conns *serverModels.Connections, eventType string) error {
|
||||||
|
if conns.Clients == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
conns.RLock()
|
||||||
|
defer conns.RUnlock()
|
||||||
|
|
||||||
|
for id := range d.Subscriptions {
|
||||||
|
if client, ok := conns.Clients[id]; !ok {
|
||||||
|
delete(d.Subscriptions, id)
|
||||||
|
} else {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.AddUPublish(json_dataModels.Publish{
|
||||||
|
Event: eventType,
|
||||||
|
Uuid: d.Uuid,
|
||||||
|
Path: d.Path,
|
||||||
|
Value: d.Value,
|
||||||
|
})
|
||||||
|
err := wsjson.Write(client.Ctx, client.Conn, r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
6
models/port.go
Normal file
6
models/port.go
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Port struct {
|
||||||
|
Http uint
|
||||||
|
Https uint
|
||||||
|
}
|
||||||
13
models/subscribtion.go
Normal file
13
models/subscribtion.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Subscriptions map[string]*Subscription
|
||||||
|
|
||||||
|
type Subscription struct {
|
||||||
|
OnCreate bool
|
||||||
|
OnDelete bool
|
||||||
|
OnChange bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitSubscribtion() Subscriptions {
|
||||||
|
return make(Subscriptions)
|
||||||
|
}
|
||||||
58
server/models/clients.go
Normal file
58
server/models/clients.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/coder/websocket"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Origins []string = []string{"*"}
|
||||||
|
|
||||||
|
type Clients map[string]*Client
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
Ctx context.Context `json:"-"`
|
||||||
|
Cancel context.CancelFunc `json:"-"`
|
||||||
|
Connected bool `json:"connected"`
|
||||||
|
Conn *websocket.Conn `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClients() Clients {
|
||||||
|
return make(Clients)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect a recieving websocket connection
|
||||||
|
func (cl *Clients) ConnectRecievingWsConnection(id string, c *gin.Context) error {
|
||||||
|
if _, exists := (*cl)[id]; exists {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
conn, err := websocket.Accept(c.Writer, c.Request, &websocket.AcceptOptions{
|
||||||
|
OriginPatterns: Origins,
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error accept websocket client: %s", err)
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
|
(*cl)[id] = &Client{
|
||||||
|
Connected: true,
|
||||||
|
Ctx: ctx,
|
||||||
|
Cancel: cancel,
|
||||||
|
Conn: conn,
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clients) RemoveClient(id string) {
|
||||||
|
delete(*c, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Clients) DisconnectWsConnection(id string, code websocket.StatusCode, reason string) {
|
||||||
|
(*c)[id].Connected = false
|
||||||
|
(*c)[id].Conn.Close(code, reason)
|
||||||
|
(*c)[id].Cancel()
|
||||||
|
}
|
||||||
32
server/models/connections.go
Normal file
32
server/models/connections.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/coder/websocket"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Connections struct {
|
||||||
|
sync.RWMutex
|
||||||
|
Clients Clients
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewConnections() *Connections {
|
||||||
|
return &Connections{
|
||||||
|
Clients: NewClients(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect a recieving websocket connection
|
||||||
|
func (c *Connections) ConnectRecievingWsConnection(id string, ctx *gin.Context) error {
|
||||||
|
return c.Clients.ConnectRecievingWsConnection(id, ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Connections) RemoveClient(id string) {
|
||||||
|
c.Clients.RemoveClient(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Connections) DisconnectWsConnection(id string, code websocket.StatusCode, reason string) {
|
||||||
|
c.Clients.DisconnectWsConnection(id, code, reason)
|
||||||
|
}
|
||||||
30
server/server.go
Normal file
30
server/server.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/tecamino/tecamino-dbm/cert"
|
||||||
|
"github.com/tecamino/tecamino-logger/logging"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
Routes *gin.Engine
|
||||||
|
sync.RWMutex
|
||||||
|
Logger *logging.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServer() *Server {
|
||||||
|
return &Server{
|
||||||
|
Routes: gin.Default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ServeHttp(port uint) error {
|
||||||
|
return s.Routes.Run(fmt.Sprintf(":%d", port))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) ServeHttps(port uint, cert cert.Cert) error {
|
||||||
|
return s.Routes.RunTLS(fmt.Sprintf(":%d", port), cert.CertFile, cert.KeyFile)
|
||||||
|
}
|
||||||
151
test/dbm_test.go
Normal file
151
test/dbm_test.go
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"runtime"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/tecamino/tecamino-dbm/args"
|
||||||
|
"github.com/tecamino/tecamino-dbm/cert"
|
||||||
|
"github.com/tecamino/tecamino-dbm/dbm"
|
||||||
|
"github.com/tecamino/tecamino-dbm/models"
|
||||||
|
"github.com/tecamino/tecamino-dbm/server"
|
||||||
|
"github.com/tecamino/tecamino-dbm/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCreateDps(t *testing.T) {
|
||||||
|
dmaHandler, err := dbm.NewDbmHandler(&args.Args{
|
||||||
|
Port: models.Port{
|
||||||
|
Http: 8100,
|
||||||
|
Https: 8101,
|
||||||
|
},
|
||||||
|
Cert: cert.Cert{
|
||||||
|
Organization: "tecamino",
|
||||||
|
CertFile: "./cert/cert.pem",
|
||||||
|
KeyFile: "./cert/key.pem",
|
||||||
|
},
|
||||||
|
RootDir: ".",
|
||||||
|
DBMFile: "Test",
|
||||||
|
Debug: false,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rand.NewSource(time.Now().UnixNano())
|
||||||
|
|
||||||
|
ndps := utils.ListofA2ZZ()
|
||||||
|
l := len(ndps)
|
||||||
|
s := time.Now()
|
||||||
|
// for _, dp := range ndps {
|
||||||
|
// for i := 0; i < 100; i++ {
|
||||||
|
// err = dmaHandler.ImportDatapoints(&models.Datapoint{
|
||||||
|
// Path: fmt.Sprintf("Test:%s:%03d", dp, i),
|
||||||
|
// Type: models.RandomType(),
|
||||||
|
// Value: rand.Int31(),
|
||||||
|
// })
|
||||||
|
// if err != nil {
|
||||||
|
// t.Fatal(err)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
fmt.Printf("time used to create %d datapoints: %v\n", l*100, time.Since(s))
|
||||||
|
|
||||||
|
var m runtime.MemStats
|
||||||
|
runtime.ReadMemStats(&m)
|
||||||
|
|
||||||
|
fmt.Printf("Allocated: %.2f MB\n", float64(m.Alloc)/1024/1024)
|
||||||
|
fmt.Printf("Total Allocated (ever): %.2f MB\n", float64(m.TotalAlloc)/1024/1024)
|
||||||
|
fmt.Printf("System Memory Obtained: %.2f MB\n", float64(m.Sys)/1024/1024)
|
||||||
|
fmt.Printf("Heap In Use: %.2f MB\n", float64(m.HeapInuse)/1024/1024)
|
||||||
|
fmt.Printf("GC Runs: %d\n", m.NumGC)
|
||||||
|
|
||||||
|
err = dmaHandler.SaveDb()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestQuery(t *testing.T) {
|
||||||
|
dmaHandler, err := dbm.NewDbmHandler(&args.Args{
|
||||||
|
Port: models.Port{
|
||||||
|
Http: 8100,
|
||||||
|
Https: 8101,
|
||||||
|
},
|
||||||
|
Cert: cert.Cert{
|
||||||
|
Organization: "tecamino",
|
||||||
|
CertFile: "./cert/cert.pem",
|
||||||
|
KeyFile: "./cert/key.pem",
|
||||||
|
},
|
||||||
|
RootDir: ".",
|
||||||
|
DBMFile: "Test",
|
||||||
|
Debug: false,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// for i, o := range dmaHandler.QueryDatapoints(".*002.*") {
|
||||||
|
// fmt.Println(600, i, o)
|
||||||
|
// }
|
||||||
|
|
||||||
|
for i, o := range dmaHandler.QueryDatapoints(1, "Test:A:000") {
|
||||||
|
fmt.Println(600, i, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateDps(t *testing.T) {
|
||||||
|
dmaHandler, err := dbm.NewDbmHandler(&args.Args{
|
||||||
|
Port: models.Port{
|
||||||
|
Http: 8100,
|
||||||
|
Https: 8101,
|
||||||
|
},
|
||||||
|
Cert: cert.Cert{
|
||||||
|
Organization: "tecamino",
|
||||||
|
CertFile: "./cert/cert.pem",
|
||||||
|
KeyFile: "./cert/key.pem",
|
||||||
|
},
|
||||||
|
RootDir: ".",
|
||||||
|
DBMFile: "Test",
|
||||||
|
Debug: false,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rand.NewSource(time.Now().UnixNano())
|
||||||
|
|
||||||
|
ndps := utils.ListofA2ZZ()
|
||||||
|
l := len(ndps)
|
||||||
|
s := time.Now()
|
||||||
|
// for j, dp := range ndps {
|
||||||
|
// if j > 2 {
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// for i := 0; i < 100; i++ {
|
||||||
|
// err = dmaHandler.UpdateDatapointValue(fmt.Sprintf("Test:%s:%03d", dp, i), rand.Int31())
|
||||||
|
// if err != nil {
|
||||||
|
// t.Fatal(err)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
fmt.Printf("time used to update %d datapoints: %v\n", l*100, time.Since(s))
|
||||||
|
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
|
fmt.Println("save data")
|
||||||
|
err = dmaHandler.SaveDb()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestServer(t *testing.T) {
|
||||||
|
fmt.Println("start")
|
||||||
|
server := server.NewServer()
|
||||||
|
|
||||||
|
t.Fatal(server.ServeHttp(8100))
|
||||||
|
}
|
||||||
430
utils/convert.go
Normal file
430
utils/convert.go
Normal file
@@ -0,0 +1,430 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Float32From(v any) float32 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case float32:
|
||||||
|
return val
|
||||||
|
case float64:
|
||||||
|
return float32(val)
|
||||||
|
case int:
|
||||||
|
return float32(val)
|
||||||
|
case int8:
|
||||||
|
return float32(val)
|
||||||
|
case int16:
|
||||||
|
return float32(val)
|
||||||
|
case int32:
|
||||||
|
return float32(val)
|
||||||
|
case int64:
|
||||||
|
return float32(val)
|
||||||
|
case uint8:
|
||||||
|
return float32(val)
|
||||||
|
case uint16:
|
||||||
|
return float32(val)
|
||||||
|
case uint32:
|
||||||
|
return float32(val)
|
||||||
|
case uint64:
|
||||||
|
return float32(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return float32(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Float64From(v any) float64 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case float32:
|
||||||
|
return float64(val)
|
||||||
|
case float64:
|
||||||
|
return val
|
||||||
|
case int:
|
||||||
|
return float64(val)
|
||||||
|
case int8:
|
||||||
|
return float64(val)
|
||||||
|
case int16:
|
||||||
|
return float64(val)
|
||||||
|
case int32:
|
||||||
|
return float64(val)
|
||||||
|
case int64:
|
||||||
|
return float64(val)
|
||||||
|
case uint8:
|
||||||
|
return float64(val)
|
||||||
|
case uint16:
|
||||||
|
return float64(val)
|
||||||
|
case uint32:
|
||||||
|
return float64(val)
|
||||||
|
case uint64:
|
||||||
|
return float64(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return float64(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Int8From(v any) int8 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return int8(val)
|
||||||
|
case int8:
|
||||||
|
return val
|
||||||
|
case int16:
|
||||||
|
return int8(val)
|
||||||
|
case int32:
|
||||||
|
return int8(val)
|
||||||
|
case int64:
|
||||||
|
return int8(val)
|
||||||
|
case uint8:
|
||||||
|
return int8(val)
|
||||||
|
case uint16:
|
||||||
|
return int8(val)
|
||||||
|
case uint32:
|
||||||
|
return int8(val)
|
||||||
|
case uint64:
|
||||||
|
return int8(val)
|
||||||
|
case float32:
|
||||||
|
return int8(val)
|
||||||
|
case float64:
|
||||||
|
return int8(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return int8(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Int16From(v any) int16 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return int16(val)
|
||||||
|
case int8:
|
||||||
|
return int16(val)
|
||||||
|
case int16:
|
||||||
|
return val
|
||||||
|
case int32:
|
||||||
|
return int16(val)
|
||||||
|
case int64:
|
||||||
|
return int16(val)
|
||||||
|
case uint8:
|
||||||
|
return int16(val)
|
||||||
|
case uint16:
|
||||||
|
return int16(val)
|
||||||
|
case uint32:
|
||||||
|
return int16(val)
|
||||||
|
case uint64:
|
||||||
|
return int16(val)
|
||||||
|
case float32:
|
||||||
|
return int16(val)
|
||||||
|
case float64:
|
||||||
|
return int16(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return int16(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Int32From(v any) int32 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return int32(val)
|
||||||
|
case int8:
|
||||||
|
return int32(val)
|
||||||
|
case int16:
|
||||||
|
return int32(val)
|
||||||
|
case int32:
|
||||||
|
return val
|
||||||
|
case int64:
|
||||||
|
return int32(val)
|
||||||
|
case uint8:
|
||||||
|
return int32(val)
|
||||||
|
case uint16:
|
||||||
|
return int32(val)
|
||||||
|
case uint32:
|
||||||
|
return int32(val)
|
||||||
|
case uint64:
|
||||||
|
return int32(val)
|
||||||
|
case float32:
|
||||||
|
return int32(val)
|
||||||
|
case float64:
|
||||||
|
return int32(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return int32(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Int64From(v any) int64 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return int64(val)
|
||||||
|
case int8:
|
||||||
|
return int64(val)
|
||||||
|
case int16:
|
||||||
|
return int64(val)
|
||||||
|
case int32:
|
||||||
|
return int64(val)
|
||||||
|
case int64:
|
||||||
|
return val
|
||||||
|
case uint8:
|
||||||
|
return int64(val)
|
||||||
|
case uint16:
|
||||||
|
return int64(val)
|
||||||
|
case uint32:
|
||||||
|
return int64(val)
|
||||||
|
case uint64:
|
||||||
|
return int64(val)
|
||||||
|
case float32:
|
||||||
|
return int64(val)
|
||||||
|
case float64:
|
||||||
|
return int64(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return int64(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Uint8From(v any) uint8 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return uint8(val)
|
||||||
|
case int8:
|
||||||
|
return uint8(val)
|
||||||
|
case int16:
|
||||||
|
return uint8(val)
|
||||||
|
case int32:
|
||||||
|
return uint8(val)
|
||||||
|
case int64:
|
||||||
|
return uint8(val)
|
||||||
|
case uint8:
|
||||||
|
return val
|
||||||
|
case uint16:
|
||||||
|
return uint8(val)
|
||||||
|
case uint32:
|
||||||
|
return uint8(val)
|
||||||
|
case uint64:
|
||||||
|
return uint8(val)
|
||||||
|
case float32:
|
||||||
|
return uint8(val)
|
||||||
|
case float64:
|
||||||
|
return uint8(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return uint8(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Uint16From(v any) uint16 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return uint16(val)
|
||||||
|
case int8:
|
||||||
|
return uint16(val)
|
||||||
|
case int16:
|
||||||
|
return uint16(val)
|
||||||
|
case int32:
|
||||||
|
return uint16(val)
|
||||||
|
case int64:
|
||||||
|
return uint16(val)
|
||||||
|
case uint8:
|
||||||
|
return uint16(val)
|
||||||
|
case uint16:
|
||||||
|
return val
|
||||||
|
case uint32:
|
||||||
|
return uint16(val)
|
||||||
|
case uint64:
|
||||||
|
return uint16(val)
|
||||||
|
case float32:
|
||||||
|
return uint16(val)
|
||||||
|
case float64:
|
||||||
|
return uint16(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return uint16(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Uint32From(v any) uint32 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return uint32(val)
|
||||||
|
case int8:
|
||||||
|
return uint32(val)
|
||||||
|
case int16:
|
||||||
|
return uint32(val)
|
||||||
|
case int32:
|
||||||
|
return uint32(val)
|
||||||
|
case int64:
|
||||||
|
return uint32(val)
|
||||||
|
case uint8:
|
||||||
|
return uint32(val)
|
||||||
|
case uint16:
|
||||||
|
return uint32(val)
|
||||||
|
case uint32:
|
||||||
|
return val
|
||||||
|
case uint64:
|
||||||
|
return uint32(val)
|
||||||
|
case float32:
|
||||||
|
return uint32(val)
|
||||||
|
case float64:
|
||||||
|
return uint32(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return uint32(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Uint64From(v any) uint64 {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
if val {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case int:
|
||||||
|
return uint64(val)
|
||||||
|
case int8:
|
||||||
|
return uint64(val)
|
||||||
|
case int16:
|
||||||
|
return uint64(val)
|
||||||
|
case int32:
|
||||||
|
return uint64(val)
|
||||||
|
case int64:
|
||||||
|
return uint64(val)
|
||||||
|
case uint8:
|
||||||
|
return uint64(val)
|
||||||
|
case uint16:
|
||||||
|
return uint64(val)
|
||||||
|
case uint32:
|
||||||
|
return uint64(val)
|
||||||
|
case uint64:
|
||||||
|
return val
|
||||||
|
case float32:
|
||||||
|
return uint64(val)
|
||||||
|
case float64:
|
||||||
|
return uint64(val)
|
||||||
|
case string:
|
||||||
|
if i, err := strconv.Atoi(val); err == nil {
|
||||||
|
return uint64(i)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
default:
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func BoolFrom(v any) bool {
|
||||||
|
switch val := v.(type) {
|
||||||
|
case bool:
|
||||||
|
return val
|
||||||
|
case int:
|
||||||
|
return val > 0
|
||||||
|
case int8:
|
||||||
|
return val > 0
|
||||||
|
case int16:
|
||||||
|
return val > 0
|
||||||
|
case int32:
|
||||||
|
return val > 0
|
||||||
|
case int64:
|
||||||
|
return val > 0
|
||||||
|
case uint8:
|
||||||
|
return val > 0
|
||||||
|
case uint16:
|
||||||
|
return val > 0
|
||||||
|
case uint32:
|
||||||
|
return val > 0
|
||||||
|
case uint64:
|
||||||
|
return val > 0
|
||||||
|
case float32:
|
||||||
|
return val >= 1
|
||||||
|
case float64:
|
||||||
|
return val >= 1
|
||||||
|
case string:
|
||||||
|
return strings.ToLower(val) == "false" || v == "0"
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
utils/utils.go
Normal file
20
utils/utils.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
func ListofA2ZZ() (list []string) {
|
||||||
|
for i := 'A'; i <= 'Z'; i++ {
|
||||||
|
list = append(list, string(i))
|
||||||
|
}
|
||||||
|
for i := 'A'; i <= 'Z'; i++ {
|
||||||
|
for j := 'A'; j <= 'Z'; j++ {
|
||||||
|
list = append(list, string(i)+string(j))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// for i := 'A'; i <= 'Z'; i++ {
|
||||||
|
// for j := 'A'; j <= 'Z'; j++ {
|
||||||
|
// for k := 'A'; k <= 'Z'; k++ {
|
||||||
|
// list = append(list, string(i)+string(j)+string(k))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
return
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user