Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
6194e1dc
Commit
6194e1dc
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Rename CurrentTargetTmp to TxTargetUser
The name reflects the functionality much better.
parent
10640754
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ATxCommon/Serializables/ServiceStatus.cs
+14
-14
14 additions, 14 deletions
ATxCommon/Serializables/ServiceStatus.cs
ATxService/AutoTx.cs
+5
-5
5 additions, 5 deletions
ATxService/AutoTx.cs
ATxService/RoboCommand.cs
+5
-4
5 additions, 4 deletions
ATxService/RoboCommand.cs
with
24 additions
and
23 deletions
ATxCommon/Serializables/ServiceStatus.cs
+
14
−
14
View file @
6194e1dc
...
@@ -22,7 +22,7 @@ namespace ATxCommon.Serializables
...
@@ -22,7 +22,7 @@ namespace ATxCommon.Serializables
private
string
_statusDescription
;
private
string
_statusDescription
;
private
string
_currentTransferSrc
;
private
string
_currentTransferSrc
;
private
string
_
curren
tTarget
Tmp
;
private
string
_t
x
Target
User
;
private
bool
_transferInProgress
;
private
bool
_transferInProgress
;
private
bool
_serviceSuspended
;
private
bool
_serviceSuspended
;
...
@@ -42,7 +42,7 @@ namespace ATxCommon.Serializables
...
@@ -42,7 +42,7 @@ namespace ATxCommon.Serializables
/// </summary>
/// </summary>
private
ServiceStatus
()
{
private
ServiceStatus
()
{
_currentTransferSrc
=
""
;
_currentTransferSrc
=
""
;
_
curren
tTarget
Tmp
=
""
;
_t
x
Target
User
=
""
;
_transferInProgress
=
false
;
_transferInProgress
=
false
;
_transferredBytesCompleted
=
0
;
_transferredBytesCompleted
=
0
;
_transferredBytesCurrentFile
=
0
;
_transferredBytesCurrentFile
=
0
;
...
@@ -183,15 +183,15 @@ namespace ATxCommon.Serializables
...
@@ -183,15 +183,15 @@ namespace ATxCommon.Serializables
}
}
/// <summary>
/// <summary>
/// The
name of the temporary folder being used for
the currently running transfer
,
/// The
user account name that should receive the data from
the currently running transfer
.
///
relative to "DestinationDirectory\TmpTransferDir" (i.e. the target username). See also
///
See also <seealso cref="CurrentTargetTmpFull"/> on details for assembling the path that
///
<seealso cref="CurrentTargetTmpFull"/> on details for assembling the full path
.
///
is being used as a temporary location while a transfer is in progress
.
/// </summary>
/// </summary>
public
string
Current
Target
Tmp
{
public
string
Tx
Target
User
{
get
=>
_
curren
tTarget
Tmp
;
get
=>
_t
x
Target
User
;
set
{
set
{
_
curren
tTarget
Tmp
=
value
;
_t
x
Target
User
=
value
;
Log
.
Trace
(
"
Current
Target
Tmp
was updated ({0})."
,
value
);
Log
.
Trace
(
"
Tx
Target
User
was updated ({0})."
,
value
);
Serialize
();
Serialize
();
}
}
}
}
...
@@ -290,7 +290,7 @@ namespace ATxCommon.Serializables
...
@@ -290,7 +290,7 @@ namespace ATxCommon.Serializables
/// <returns>A string with the path to the last tmp dir.</returns>
/// <returns>A string with the path to the last tmp dir.</returns>
public
string
CurrentTargetTmpFull
()
{
public
string
CurrentTargetTmpFull
()
{
return
Path
.
Combine
(
_config
.
DestinationDirectory
,
return
Path
.
Combine
(
_config
.
DestinationDirectory
,
_
curren
tTarget
Tmp
,
_t
x
Target
User
,
_config
.
TmpTransferDir
,
_config
.
TmpTransferDir
,
Environment
.
MachineName
);
Environment
.
MachineName
);
}
}
...
@@ -331,13 +331,13 @@ namespace ATxCommon.Serializables
...
@@ -331,13 +331,13 @@ namespace ATxCommon.Serializables
s
.
CurrentTransferSrc
=
""
;
s
.
CurrentTransferSrc
=
""
;
}
}
//
Current
Target
Tmp
//
Tx
Target
User
var
currentTargetTmpPath
=
s
.
CurrentTargetTmpFull
();
var
currentTargetTmpPath
=
s
.
CurrentTargetTmpFull
();
if
(
s
.
Current
Target
Tmp
.
Length
>
0
if
(
s
.
Tx
Target
User
.
Length
>
0
&&
!
Directory
.
Exists
(
currentTargetTmpPath
))
{
&&
!
Directory
.
Exists
(
currentTargetTmpPath
))
{
ReportInvalidStatus
(
"CurrentTargetTmpPath"
,
currentTargetTmpPath
,
ReportInvalidStatus
(
"CurrentTargetTmpPath"
,
currentTargetTmpPath
,
"invalid temporary path of an unfinished transfer"
);
"invalid temporary path of an unfinished transfer"
);
s
.
Current
Target
Tmp
=
""
;
s
.
Tx
Target
User
=
""
;
}
}
}
}
...
@@ -356,7 +356,7 @@ namespace ATxCommon.Serializables
...
@@ -356,7 +356,7 @@ namespace ATxCommon.Serializables
public
string
Summary
()
{
public
string
Summary
()
{
return
return
$"CurrentTransferSrc:
{
CurrentTransferSrc
}
\n"
+
$"CurrentTransferSrc:
{
CurrentTransferSrc
}
\n"
+
$"
CurrentTargetTmp:
{
Current
Target
Tmp
}
\n"
+
$"
TxTargetUser:
{
Tx
Target
User
}
\n"
+
$"TransferInProgress:
{
TransferInProgress
}
\n"
+
$"TransferInProgress:
{
TransferInProgress
}
\n"
+
$"CurrentTransferSize:
{
CurrentTransferSize
}
\n"
+
$"CurrentTransferSize:
{
CurrentTransferSize
}
\n"
+
$"LastStatusUpdate:
{
LastStatusUpdate
:
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
+
$"LastStatusUpdate:
{
LastStatusUpdate
:
yyyy
-
MM
-
dd
HH
:
mm
:
ss
}
"
+
...
...
This diff is collapsed.
Click to expand it.
ATxService/AutoTx.cs
+
5
−
5
View file @
6194e1dc
...
@@ -749,13 +749,13 @@ namespace ATxService
...
@@ -749,13 +749,13 @@ namespace ATxService
if
(
_transferState
!=
TxState
.
Stopped
||
_status
.
TransferInProgress
)
if
(
_transferState
!=
TxState
.
Stopped
||
_status
.
TransferInProgress
)
return
;
return
;
if
(
_status
.
Current
Target
Tmp
.
Length
>
0
)
{
if
(
_status
.
Tx
Target
User
.
Length
>
0
)
{
Log
.
Debug
(
"Finalizing transfer, cleaning up target storage location..."
);
Log
.
Debug
(
"Finalizing transfer, cleaning up target storage location..."
);
var
finalDst
=
DestinationPath
(
_status
.
Current
Target
Tmp
);
var
finalDst
=
DestinationPath
(
_status
.
Tx
Target
User
);
if
(!
string
.
IsNullOrWhiteSpace
(
finalDst
))
{
if
(!
string
.
IsNullOrWhiteSpace
(
finalDst
))
{
if
(
FsUtils
.
MoveAllSubDirs
(
new
DirectoryInfo
(
_status
.
CurrentTargetTmpFull
()),
if
(
FsUtils
.
MoveAllSubDirs
(
new
DirectoryInfo
(
_status
.
CurrentTargetTmpFull
()),
finalDst
,
_config
.
EnforceInheritedACLs
))
{
finalDst
,
_config
.
EnforceInheritedACLs
))
{
_status
.
Current
Target
Tmp
=
""
;
_status
.
Tx
Target
User
=
""
;
}
}
}
}
}
}
...
@@ -803,10 +803,10 @@ namespace ATxService
...
@@ -803,10 +803,10 @@ namespace ATxService
/// </summary>
/// </summary>
private
void
ResumeInterruptedTransfer
()
{
private
void
ResumeInterruptedTransfer
()
{
// CONDITIONS (a transfer has to be resumed):
// CONDITIONS (a transfer has to be resumed):
// -
Current
Target
Tmp
has to be non-empty
// -
Tx
Target
User
has to be non-empty
// - TransferState has to be "Stopped"
// - TransferState has to be "Stopped"
// - TransferInProgress must be true
// - TransferInProgress must be true
if
(
_status
.
Current
Target
Tmp
.
Length
<=
0
||
if
(
_status
.
Tx
Target
User
.
Length
<=
0
||
_transferState
!=
TxState
.
Stopped
||
_transferState
!=
TxState
.
Stopped
||
_status
.
TransferInProgress
==
false
)
_status
.
TransferInProgress
==
false
)
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
ATxService/RoboCommand.cs
+
5
−
4
View file @
6194e1dc
...
@@ -10,12 +10,13 @@ namespace ATxService
...
@@ -10,12 +10,13 @@ namespace ATxService
{
{
/// <summary>
/// <summary>
/// Start transferring data from a given source directory to the destination
/// Start transferring data from a given source directory to the destination
/// location that is
stored in Current
Target
Tmp
. Requires CopyState to be in
/// location that is
derived from Tx
Target
User
. Requires CopyState to be in
/// status "Stopped", sets CopyState to "Active" and FilecopyFinished to
/// status "Stopped", sets CopyState to "Active" and FilecopyFinished to
/// false. The currently processed path is stored in the global status
/// false. The currently processed path is stored in the global status
/// variable CurrentTransferSrc.
/// variable CurrentTransferSrc.
/// </summary>
/// </summary>
/// <param name="sourcePath">The full path to a folder.</param>
/// <param name="sourcePath">The full path to a folder. By convention, the
/// LAST element of the path has to match the target user name!</param>
private
void
StartTransfer
(
string
sourcePath
)
{
private
void
StartTransfer
(
string
sourcePath
)
{
// only proceed when in a valid state:
// only proceed when in a valid state:
if
(
_transferState
!=
TxState
.
Stopped
)
if
(
_transferState
!=
TxState
.
Stopped
)
...
@@ -32,8 +33,8 @@ namespace ATxService
...
@@ -32,8 +33,8 @@ namespace ATxService
_status
.
CurrentTransferSize
=
totalSize
;
_status
.
CurrentTransferSize
=
totalSize
;
_status
.
CurrentTransferSrc
=
sourcePath
;
_status
.
CurrentTransferSrc
=
sourcePath
;
// the user name is expected to be the last part of
the p
ath:
// the user name is expected to be the last part of
sourceP
ath:
_status
.
Current
Target
Tmp
=
new
DirectoryInfo
(
sourcePath
).
Name
;
_status
.
Tx
Target
User
=
new
DirectoryInfo
(
sourcePath
).
Name
;
FsUtils
.
CreateNewDirectory
(
_status
.
CurrentTargetTmpFull
(),
false
);
FsUtils
.
CreateNewDirectory
(
_status
.
CurrentTargetTmpFull
(),
false
);
_transferState
=
TxState
.
Active
;
_transferState
=
TxState
.
Active
;
...
...
This diff is collapsed.
Click to expand it.
Niko Ehrenfeuchter
@ehrenfeu
·
6 years ago
Author
Owner
Relates to
#16 (closed)
Relates to #16
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment