forked from PowershellFrameworkCollective/psframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1225600
commit 2cac301
Showing
33 changed files
with
443 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
PSFramework/functions/runspace/Get-PSFRunspaceDispatcher.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
function Get-PSFRunspaceDispatcher { | ||
function Get-PSFRunspaceWorkflow { | ||
<# | ||
.SYNOPSIS | ||
Returns a list of registered runspace dispatchers. | ||
Returns a list of registered runspace workflows. | ||
.DESCRIPTION | ||
Returns a list of registered runspace dispatchers. | ||
A Runspace dispatcher is the main component managing a PSFramework Runspace Workflow | ||
Returns a list of registered runspace workflows. | ||
A Runspace workflow object is the main component managing a PSFramework Runspace Workflow | ||
.PARAMETER Name | ||
By which name to filter. | ||
Defaults to * | ||
.EXAMPLE | ||
PS C:\> Get-PSFRunspaceDispatcher | ||
PS C:\> Get-PSFRunspaceWorkflow | ||
Returns all registered runspace dispatchers. | ||
Returns all registered runspace workflows. | ||
.LINK | ||
TODO: Add link to section | ||
https://psframework.org/documentation/documents/psframework/runspace-workflows.html | ||
#> | ||
[CmdletBinding()] | ||
param ( | ||
[string] | ||
$Name = '*' | ||
) | ||
process { | ||
($script:runspaceDispatchers.Values | Where-Object Name -Like $Name) | ||
($script:runspaceWorkflows.Values | Where-Object Name -Like $Name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
PSFramework/functions/runspace/New-PSFRunspaceDispatcher.ps1
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
PSFramework/functions/runspace/New-PSFRunspaceWorkflow.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
function New-PSFRunspaceWorkflow { | ||
<# | ||
.SYNOPSIS | ||
Creates a new runspace workflow. | ||
.DESCRIPTION | ||
Creates a new runspace workflow. | ||
The workflow object is the core element of the runspace workflow system. | ||
It contains the workers, runspaces and queues that execute the workflow. | ||
All workflows are stored centrally and cen be retrieved using Get-PSFRunspaceWorkflow. | ||
To ensure proper cleanup, remember to use Remove-PSFRunspaceWorkflow when completed. | ||
.PARAMETER Name | ||
The name of the workflow to create. | ||
Must be unique in the current runspace. | ||
.PARAMETER Force | ||
Allows overwriting an existing workflow of the same name. | ||
Note: Doing so will terminate all processing on the previous workflow. | ||
.EXAMPLE | ||
PS C:\> New-PSFRunspaceWorkflow -Name 'MyModule.MyWorkflow | ||
Creates a new Runspace Workflow with the name 'MyModule.MyWorkflow' | ||
.LINK | ||
https://psframework.org/documentation/documents/psframework/runspace-workflows.html | ||
.LINK | ||
Get-PSFRunspaceWorkflow | ||
.LINK | ||
Remove-PSFRunspaceWorkflow | ||
#> | ||
[OutputType([PSFramework.Runspace.RSDispatcher])] | ||
[CmdletBinding()] | ||
param ( | ||
[string] | ||
$Name, | ||
|
||
[switch] | ||
$Force | ||
) | ||
process { | ||
if ($script:runspaceWorkflows[$Name]) { | ||
if (-not $Force) { | ||
Stop-PSFFunction -String 'New-PSFRunspaceWorkflow.Error.ExistsAlready' -StringValues $Name -EnableException $true -Cmdlet $PSCmdlet | ||
} | ||
|
||
$script:runspaceWorkflows[$Name].Stop() | ||
} | ||
|
||
$script:runspaceWorkflows[$Name] = [PSFramework.Runspace.RSDispatcher]::new($Name) | ||
$script:runspaceWorkflows[$Name] | ||
} | ||
} |
Oops, something went wrong.