You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/04/03 23:54:02 UTC
[5/6] incubator-mynewt-newtmgr git commit: nmxact - Initilize
commands with default tx opts.
nmxact - Initilize commands with default tx opts.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/d7b0a1a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/d7b0a1a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/d7b0a1a0
Branch: refs/heads/master
Commit: d7b0a1a03f73c1f0cf09e5f01ab13655daf24c92
Parents: 2f088b4
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Apr 3 16:47:27 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Apr 3 16:52:30 2017 -0700
----------------------------------------------------------------------
nmxact/sesn/sesn.go | 7 +++++++
nmxact/xact/cmd.go | 6 ++++++
nmxact/xact/config.go | 8 ++++++--
nmxact/xact/crash.go | 4 +++-
nmxact/xact/datetime.go | 8 ++++++--
nmxact/xact/echo.go | 4 +++-
nmxact/xact/fs.go | 8 ++++++--
nmxact/xact/image.go | 24 ++++++++++++++++++------
nmxact/xact/log.go | 20 +++++++++++++++-----
nmxact/xact/mpstat.go | 4 +++-
nmxact/xact/reset.go | 4 +++-
nmxact/xact/run.go | 8 ++++++--
nmxact/xact/stat.go | 8 ++++++--
nmxact/xact/taskstat.go | 4 +++-
14 files changed, 91 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/sesn/sesn.go
----------------------------------------------------------------------
diff --git a/nmxact/sesn/sesn.go b/nmxact/sesn/sesn.go
index 8ef8934..0782e63 100644
--- a/nmxact/sesn/sesn.go
+++ b/nmxact/sesn/sesn.go
@@ -12,6 +12,13 @@ type TxOptions struct {
Tries int
}
+func NewTxOptions() TxOptions {
+ return TxOptions{
+ Timeout: 10 * time.Second,
+ Tries: 1,
+ }
+}
+
func (opt *TxOptions) AfterTimeout() <-chan time.Time {
if opt.Timeout == 0 {
return nil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/cmd.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/cmd.go b/nmxact/xact/cmd.go
index d5d7a23..9bc3728 100644
--- a/nmxact/xact/cmd.go
+++ b/nmxact/xact/cmd.go
@@ -45,6 +45,12 @@ type CmdBase struct {
abortErr error
}
+func NewCmdBase() CmdBase {
+ return CmdBase{
+ txOptions: sesn.NewTxOptions(),
+ }
+}
+
func (c *CmdBase) TxOptions() sesn.TxOptions {
return c.txOptions
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/config.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/config.go b/nmxact/xact/config.go
index ddc893b..fc55505 100644
--- a/nmxact/xact/config.go
+++ b/nmxact/xact/config.go
@@ -15,7 +15,9 @@ type ConfigReadCmd struct {
}
func NewConfigReadCmd() *ConfigReadCmd {
- return &ConfigReadCmd{}
+ return &ConfigReadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type ConfigReadResult struct {
@@ -56,7 +58,9 @@ type ConfigWriteCmd struct {
}
func NewConfigWriteCmd() *ConfigWriteCmd {
- return &ConfigWriteCmd{}
+ return &ConfigWriteCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type ConfigWriteResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/crash.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/crash.go b/nmxact/xact/crash.go
index ebb94c7..f665c88 100644
--- a/nmxact/xact/crash.go
+++ b/nmxact/xact/crash.go
@@ -56,7 +56,9 @@ type CrashCmd struct {
}
func NewCrashCmd() *CrashCmd {
- return &CrashCmd{}
+ return &CrashCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type CrashResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/datetime.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/datetime.go b/nmxact/xact/datetime.go
index 27bd089..f6622df 100644
--- a/nmxact/xact/datetime.go
+++ b/nmxact/xact/datetime.go
@@ -14,7 +14,9 @@ type DateTimeReadCmd struct {
}
func NewDateTimeReadCmd() *DateTimeReadCmd {
- return &DateTimeReadCmd{}
+ return &DateTimeReadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type DateTimeReadResult struct {
@@ -53,7 +55,9 @@ type DateTimeWriteCmd struct {
}
func NewDateTimeWriteCmd() *DateTimeWriteCmd {
- return &DateTimeWriteCmd{}
+ return &DateTimeWriteCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type DateTimeWriteResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/echo.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/echo.go b/nmxact/xact/echo.go
index 09622b2..630e876 100644
--- a/nmxact/xact/echo.go
+++ b/nmxact/xact/echo.go
@@ -11,7 +11,9 @@ type EchoCmd struct {
}
func NewEchoCmd() *EchoCmd {
- return &EchoCmd{}
+ return &EchoCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type EchoResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/fs.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/fs.go b/nmxact/xact/fs.go
index 0fe32c6..c6668de 100644
--- a/nmxact/xact/fs.go
+++ b/nmxact/xact/fs.go
@@ -19,7 +19,9 @@ type FsDownloadCmd struct {
}
func NewFsDownloadCmd() *FsDownloadCmd {
- return &FsDownloadCmd{}
+ return &FsDownloadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type FsDownloadResult struct {
@@ -81,7 +83,9 @@ type FsUploadCmd struct {
}
func NewFsUploadCmd() *FsUploadCmd {
- return &FsUploadCmd{}
+ return &FsUploadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type FsUploadResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/image.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/image.go b/nmxact/xact/image.go
index 615dd74..55ba44c 100644
--- a/nmxact/xact/image.go
+++ b/nmxact/xact/image.go
@@ -23,7 +23,9 @@ type ImageUploadResult struct {
}
func NewImageUploadCmd() *ImageUploadCmd {
- return &ImageUploadCmd{}
+ return &ImageUploadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
func newImageUploadResult() *ImageUploadResult {
@@ -127,7 +129,9 @@ type ImageStateReadResult struct {
}
func NewImageStateReadCmd() *ImageStateReadCmd {
- return &ImageStateReadCmd{}
+ return &ImageStateReadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
func newImageStateReadResult() *ImageStateReadResult {
@@ -167,7 +171,9 @@ type ImageStateWriteResult struct {
}
func NewImageStateWriteCmd() *ImageStateWriteCmd {
- return &ImageStateWriteCmd{}
+ return &ImageStateWriteCmd{
+ CmdBase: NewCmdBase(),
+ }
}
func newImageStateWriteResult() *ImageStateWriteResult {
@@ -207,7 +213,9 @@ type CoreListResult struct {
}
func NewCoreListCmd() *CoreListCmd {
- return &CoreListCmd{}
+ return &CoreListCmd{
+ CmdBase: NewCmdBase(),
+ }
}
func newCoreListResult() *CoreListResult {
@@ -247,7 +255,9 @@ type CoreLoadResult struct {
}
func NewCoreLoadCmd() *CoreLoadCmd {
- return &CoreLoadCmd{}
+ return &CoreLoadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
func newCoreLoadResult() *CoreLoadResult {
@@ -306,7 +316,9 @@ type CoreEraseResult struct {
}
func NewCoreEraseCmd() *CoreEraseCmd {
- return &CoreEraseCmd{}
+ return &CoreEraseCmd{
+ CmdBase: NewCmdBase(),
+ }
}
func newCoreEraseResult() *CoreEraseResult {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/log.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/log.go b/nmxact/xact/log.go
index 86b348f..f71f8a3 100644
--- a/nmxact/xact/log.go
+++ b/nmxact/xact/log.go
@@ -17,7 +17,9 @@ type LogShowCmd struct {
}
func NewLogShowCmd() *LogShowCmd {
- return &LogShowCmd{}
+ return &LogShowCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type LogShowResult struct {
@@ -58,7 +60,9 @@ type LogListCmd struct {
}
func NewLogListCmd() *LogListCmd {
- return &LogListCmd{}
+ return &LogListCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type LogListResult struct {
@@ -96,7 +100,9 @@ type LogModuleListCmd struct {
}
func NewLogModuleListCmd() *LogModuleListCmd {
- return &LogModuleListCmd{}
+ return &LogModuleListCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type LogModuleListResult struct {
@@ -134,7 +140,9 @@ type LogLevelListCmd struct {
}
func NewLogLevelListCmd() *LogLevelListCmd {
- return &LogLevelListCmd{}
+ return &LogLevelListCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type LogLevelListResult struct {
@@ -172,7 +180,9 @@ type LogClearCmd struct {
}
func NewLogClearCmd() *LogClearCmd {
- return &LogClearCmd{}
+ return &LogClearCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type LogClearResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/mpstat.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/mpstat.go b/nmxact/xact/mpstat.go
index acff3e2..cb7b0da 100644
--- a/nmxact/xact/mpstat.go
+++ b/nmxact/xact/mpstat.go
@@ -10,7 +10,9 @@ type MempoolStatCmd struct {
}
func NewMempoolStatCmd() *MempoolStatCmd {
- return &MempoolStatCmd{}
+ return &MempoolStatCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type MempoolStatResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/reset.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/reset.go b/nmxact/xact/reset.go
index 397ad60..08a1040 100644
--- a/nmxact/xact/reset.go
+++ b/nmxact/xact/reset.go
@@ -11,7 +11,9 @@ type ResetCmd struct {
}
func NewResetCmd() *ResetCmd {
- return &ResetCmd{}
+ return &ResetCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type ResetResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/run.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/run.go b/nmxact/xact/run.go
index 28d71a9..d1af353 100644
--- a/nmxact/xact/run.go
+++ b/nmxact/xact/run.go
@@ -16,7 +16,9 @@ type RunTestCmd struct {
}
func NewRunTestCmd() *RunTestCmd {
- return &RunTestCmd{}
+ return &RunTestCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type RunTestResult struct {
@@ -56,7 +58,9 @@ type RunListCmd struct {
}
func NewRunListCmd() *RunListCmd {
- return &RunListCmd{}
+ return &RunListCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type RunListResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/stat.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/stat.go b/nmxact/xact/stat.go
index a38eba9..f921afa 100644
--- a/nmxact/xact/stat.go
+++ b/nmxact/xact/stat.go
@@ -15,7 +15,9 @@ type StatReadCmd struct {
}
func NewStatReadCmd() *StatReadCmd {
- return &StatReadCmd{}
+ return &StatReadCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type StatReadResult struct {
@@ -54,7 +56,9 @@ type StatListCmd struct {
}
func NewStatListCmd() *StatListCmd {
- return &StatListCmd{}
+ return &StatListCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type StatListResult struct {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/d7b0a1a0/nmxact/xact/taskstat.go
----------------------------------------------------------------------
diff --git a/nmxact/xact/taskstat.go b/nmxact/xact/taskstat.go
index bb03357..a2e82c4 100644
--- a/nmxact/xact/taskstat.go
+++ b/nmxact/xact/taskstat.go
@@ -10,7 +10,9 @@ type TaskStatCmd struct {
}
func NewTaskStatCmd() *TaskStatCmd {
- return &TaskStatCmd{}
+ return &TaskStatCmd{
+ CmdBase: NewCmdBase(),
+ }
}
type TaskStatResult struct {