Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data accessor #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions etc/config.yaml.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
manager:
http:
port: 10996
meta_store:
type: file
file:
path: etc/resources
data_store:
type: influxdb

database: "thingio"
# https://docs.influxdata.com/influxdb/v2.0/write-data/best-practices/optimize-writes/#batch-writes
batch_size: 5000

influxdb:
url: "http://127.0.0.1:8086"
username: ""
password: ""
retention_policy: ""
write_consistency: ""
timeout: "30s"
tdengine:
schema: "tcp"
host: "127.0.0.1"
port: 6030
username: "root"
password: "taosdata"
keep: 3650
days: 10
blocks: 6
update: 0
precision: "ns"

msgbus:
type: "MQTT"
Expand Down
7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
module github.com/thingio/edge-device-manager

replace github.com/thingio/edge-device-std v0.2.1 => ../edge-device-std

require (
github.com/apache/arrow/go/v8 v8.0.0
github.com/emicklei/go-restful-openapi/v2 v2.8.0
github.com/emicklei/go-restful/v3 v3.7.3
github.com/go-openapi/spec v0.20.4
github.com/gobwas/ws v1.1.0
github.com/influxdata/influxdb v1.9.7
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.8.1
github.com/pkg/errors v0.9.1
github.com/taosdata/driver-go/v2 v2.0.1-0.20220523115057-e3107e343c03
github.com/thingio/edge-device-std v0.2.1
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
7 changes: 1 addition & 6 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package main

import (
"github.com/thingio/edge-device-manager/pkg/metastore"
"github.com/thingio/edge-device-manager/pkg/startup"
)

func main() {
metaStore, err := metastore.NewFileMetaStore(metastore.DefaultFileMetaStorePath)
if err != nil {
panic(err)
}
startup.Startup(metaStore)
startup.Startup()
}
17 changes: 9 additions & 8 deletions pkg/api/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@ package http

import (
"github.com/emicklei/go-restful/v3"
"github.com/patrickmn/go-cache"
"github.com/thingio/edge-device-manager/pkg/api/http/device"
"github.com/thingio/edge-device-manager/pkg/api/http/naive"
"github.com/thingio/edge-device-manager/pkg/api/http/product"
"github.com/thingio/edge-device-manager/pkg/api/http/protocol"
"github.com/thingio/edge-device-manager/pkg/api/http/swagger"
"github.com/thingio/edge-device-manager/pkg/metastore"
"github.com/thingio/edge-device-std/operations"
"github.com/thingio/edge-device-manager/pkg/manager"
)

const (
ApiRoot = "/api/v1"
)

func MountAllModules(protocols *cache.Cache, metaStore metastore.MetaStore,
mc operations.ManagerClient, ms operations.ManagerService) {
func MountAllModules(manager *manager.DeviceManager) {
restful.Add(swagger.Resource{}.WebService("/apidocs"))

restful.Add(protocol.Resource{ProtocolCache: protocols}.WebService(ApiRoot + "/protocols"))
restful.Add(product.Resource{ProtocolCache: protocols, MetaStore: metaStore, OperationClient: mc}.WebService(ApiRoot + "/products"))
restful.Add(device.Resource{MetaStore: metaStore, OperationClient: mc, OperationService: ms}.WebService(ApiRoot + "/devices"))
restful.Add(protocol.Resource{Manager: manager}.WebService(ApiRoot + "/protocols"))
restful.Add(product.Resource{Manager: manager}.WebService(ApiRoot + "/products"))
dr := device.Resource{Manager: manager}
restful.Add(dr.WebService(ApiRoot + "/devices"))

restful.Add(naive.Resource{Manager: manager}.WebService(ApiRoot))
}
Loading