-
Notifications
You must be signed in to change notification settings - Fork 13
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
Ebonilla/sy 749 opc ua read task cleanup and tests #640
Changes from all commits
abca46a
6dffeca
5fac362
2f6096f
8e6fdb2
2447422
a878a78
845ed3d
7b3bd54
af15bae
bb11bf9
3b4a2d4
93543bb
ddca8e3
c42852c
1136f44
ff6558e
a69d39a
2798298
7aa4e05
c536471
1f1c0fd
6ebdf91
1f5c005
0f00f60
5d305da
b859f99
95d8623
17ca2f8
c3a292a
4dcdf7f
fe6a4e8
71aca51
06dd7fc
36a2c4c
c918cca
d561ba9
8985eb0
6d26177
6efc309
aedfedd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,13 @@ | |
"github.com/synnaxlabs/cesium/internal/meta" | ||
"github.com/synnaxlabs/cesium/internal/version" | ||
"github.com/synnaxlabs/x/binary" | ||
"github.com/synnaxlabs/x/config" | ||
"github.com/synnaxlabs/x/control" | ||
"github.com/synnaxlabs/x/errors" | ||
xfs "github.com/synnaxlabs/x/io/fs" | ||
"github.com/synnaxlabs/x/override" | ||
"github.com/synnaxlabs/x/telem" | ||
"github.com/synnaxlabs/x/validate" | ||
"sync" | ||
"sync/atomic" | ||
) | ||
|
@@ -58,8 +62,37 @@ | |
Channel core.Channel | ||
} | ||
|
||
func Open(cfg Config) (db *DB, err error) { | ||
c, err := controller.New[*controlEntity](controller.Config{Concurrency: cfg.Channel.Concurrency, Instrumentation: cfg.Instrumentation}) | ||
var ( | ||
_ config.Config[Config] = Config{} | ||
DefaultConfig = Config{} | ||
) | ||
|
||
// Validate implements config.Config. | ||
func (cfg Config) Validate() error { | ||
v := validate.New("cesium.virtual") | ||
validate.NotNil(v, "FS", cfg.FS) | ||
return v.Error() | ||
} | ||
|
||
// Override implements config.Config. | ||
func (cfg Config) Override(other Config) Config { | ||
cfg.FS = override.Nil(cfg.FS, other.FS) | ||
if cfg.Channel.Key == 0 { | ||
cfg.Channel = other.Channel | ||
} | ||
cfg.Instrumentation = override.Zero(cfg.Instrumentation, other.Instrumentation) | ||
return cfg | ||
} | ||
|
||
func Open(configs ...Config) (db *DB, err error) { | ||
cfg, err := config.New(DefaultConfig, configs...) | ||
if err != nil { | ||
return nil, err | ||
} | ||
c, err := controller.New[*controlEntity](controller.Config{ | ||
Concurrency: control.Shared, | ||
Instrumentation: cfg.Instrumentation, | ||
}) | ||
if err != nil { | ||
return nil, err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrap |
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
"github.com/synnaxlabs/cesium/internal/virtual" | ||
"github.com/synnaxlabs/x/config" | ||
"github.com/synnaxlabs/x/control" | ||
xfs "github.com/synnaxlabs/x/io/fs" | ||
"github.com/synnaxlabs/x/telem" | ||
. "github.com/synnaxlabs/x/testutil" | ||
) | ||
|
@@ -20,6 +21,7 @@ var _ = Describe("Write", func() { | |
DataType: telem.TimeStampT, | ||
Virtual: true, | ||
}, | ||
FS: xfs.NewMem(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why only mem FS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FS implementation is still checked for in the config but does not apply to any test cases. Feel free to adjust as you build out future test suites |
||
})) | ||
}) | ||
AfterEach(func() { | ||
|
@@ -37,7 +39,7 @@ var _ = Describe("Write", func() { | |
Expect(t.Occurred()).To(BeTrue()) | ||
w2, t, err := db.OpenWriter(ctx, virtual.WriterConfig{ | ||
Start: 10 * telem.SecondTS, | ||
Authority: control.Absolute, | ||
Authority: control.Absolute - 1, | ||
Subject: control.Subject{Key: "bar"}, | ||
ErrOnUnauthorized: config.True(), | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"files.associations": { | ||
"memory": "cpp" | ||
} | ||
"files.associations": { | ||
"memory": "cpp" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap